我很难在我的iPhone应用程序中使用非常简单的(Hello World)WCF Web服务.根据我的阅读,您必须手动创建请求消息,然后将其发送到Web服务URL.
我能够在.asmx Web服务上完成此任务,但不能使用WCF服务.
我如何知道请求SOAP消息的正确格式?
我试图访问的Web服务格式为:http://xxx.xxx.xxx.xxx: PORT/IService1 /(在VM中本地运行)
我为缺乏信息而道歉,我很遗憾.
任何和所有的帮助非常感谢.
我试图在视图加载后将地图缩放到用户的当前位置,但是我收到错误"***由于未捕获的异常终止应用程序'NSInvalidArgumentException',原因:'无效区域' "当视图加载时.请有人帮忙吗?
干杯!
- (void)viewDidLoad
{
[super viewDidLoad];
MKCoordinateRegion mapRegion;
mapRegion.center.latitude = map.userLocation.coordinate.latitude;
mapRegion.center.longitude = map.userLocation.coordinate.longitude;
mapRegion.span.latitudeDelta = 0.2;
mapRegion.span.longitudeDelta = 0.2;
[map setRegion:mapRegion animated: YES];
}
Run Code Online (Sandbox Code Playgroud) 我想在中添加密钥对值plist.我不知道如何在XCode中添加.plist文件.我只想在名为" Mobile.plist"的.plist文件中添加这些细节.
Apple - iPhone,iPod,iPad
Samsung - Galaxy Y, Galaxy R, Galaxy Z
Nokia - Lumina
LG - Lg1 ,Lg2, Lg3
Run Code Online (Sandbox Code Playgroud)
我已尝试使用此链接创建新的Mobile.plist文件的步骤,
http://iphoneincubator.com/blog/tutorial/how-to-create-an-iphone-preferences-file.但是,我无法完全理解.当我尝试使用此链接中的步骤时,plist文件始终为空.我不知道如何在plist中添加键值.
我创建了一个名为的组Settings and add new plist file named as Root.plist.您能否提供创建.plist文件并在其中添加键值的步骤.提前致谢.
我需要使用Xcode为我的ios应用程序实现WKWebview.但是当我使用它"未声明的类型'WKWebview'"时我有错误.我错过了什么重要的东西.
我正在使用App Store中最新的Xcode7下载.
我正在玩GCD,我写了一个玩具CoinFlipper应用程序.
这是翻转硬币的方法:
- (void)flipCoins:(NSUInteger)nFlips{
// Create the queues for work
dispatch_queue_t mainQueue = dispatch_get_main_queue();
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, NULL);
// Split the number of flips into whole chunks of kChunkSize and the remainder.
NSUInteger numberOfWholeChunks = nFlips / kChunkSize;
NSUInteger numberOfRemainingFlips = nFlips - numberOfWholeChunks * kChunkSize;
if (numberOfWholeChunks > 0) {
for (NSUInteger index = 0; index < numberOfWholeChunks; index++) {
dispatch_async(queue, ^{
NSUInteger h = 0;
NSUInteger t = 0;
flipTheCoins(kChunkSize, &h, &t);
dispatch_async(mainQueue, ^{
self.nHeads += h; …Run Code Online (Sandbox Code Playgroud) 我正在创建一个库来获取具有指定数据和方法类型的特定URL的响应.为此,我正在使用url提出请求.但是当我设置它的方法类型时,它显示了一个异常的无法识别的选择器发送,[NSURLRequest setHTTPMethod:]
我将其设置为
[requestObject setHTTPMethod:@"GET"];
Run Code Online (Sandbox Code Playgroud)
告诉我可能是什么问题.如果你有,也提供给我代码.
我在viewDidLoad中有以下循环:
for(int i=1; i<[eventsArray count]; i++) {
NSArray *componentsArray = [[eventsArray objectAtIndex:i] componentsSeparatedByString:@","];
if([componentsArray count] >=6) {
Koordinate *coord = [[Koordinate alloc] init];
coord.latitude = [[componentsArray objectAtIndex:0] floatValue];
coord.longtitude = [[componentsArray objectAtIndex:1] floatValue];
coord.magnitude = [[componentsArray objectAtIndex:2] floatValue];
coord.depth = [[componentsArray objectAtIndex:3] floatValue];
coord.title = [componentsArray objectAtIndex:4];
coord.strasse = [componentsArray objectAtIndex:5];
coord.herkunft = [componentsArray objectAtIndex:6];
coord.telefon = [componentsArray objectAtIndex:7];
coord.internet = [componentsArray objectAtIndex:8];
[eventPoints addObject:coord];
}
Run Code Online (Sandbox Code Playgroud)
coord是CLLocationCoordinate2D
但是我如何在下面的方法中使用coord,因为我需要这个以获得两个坐标之间的距离:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation{
}
Run Code Online (Sandbox Code Playgroud)
请帮帮我,我被困了!
谢谢大家事先帮忙
我想为某些单元测试创建一些数据目录,我希望这些目录位于用户的默认临时目录中.
我想在/ tmp下我可以创建一个子目录,但我不想假设有人建立了自己的机器.
我正计划动态编写测试数据,这就是为什么我想把它放到一个临时目录中.
我有一个NSString对象数组,我必须通过降序排序.
由于我没有找到任何API来按降序对数组进行排序,我通过以下方式接近.
我为下面列出的NSString写了一个类别.
- (NSComparisonResult)CompareDescending:(NSString *)aString
{
NSComparisonResult returnResult = NSOrderedSame;
returnResult = [self compare:aString];
if(NSOrderedAscending == returnResult)
returnResult = NSOrderedDescending;
else if(NSOrderedDescending == returnResult)
returnResult = NSOrderedAscending;
return returnResult;
}
Run Code Online (Sandbox Code Playgroud)
然后我使用语句对数组进行了排序
NSArray *sortedArray = [inFileTypes sortedArrayUsingSelector:@selector(CompareDescending:)];
Run Code Online (Sandbox Code Playgroud)
这是正确的解决方案?有更好的解决方案吗?
在Objective C中,每当我必须访问测试包时,我都会调用它
[NSBundle bundleForClass:[ClassInTestTarget class]];
Run Code Online (Sandbox Code Playgroud)
bundleForClass 在Swift中不可用,那么如何访问测试包呢?
我需要这个的原因是,为了编写我正在研究的框架的测试,我必须使用内存核心数据堆栈.最初所有资源都包含在主目标和测试目标中,但之后我将所有这些测试帮助程序仅移动到测试目标,现在下面的代码返回nil,这导致我的所有测试失败
let modelURL = NSBundle.mainBundle().URLForResource("Model", withExtension: "momd")
Run Code Online (Sandbox Code Playgroud)