小编Abi*_*ern的帖子

在iPhone上使用Objective-C使用WCF Web服务

我很难在我的iPhone应用程序中使用非常简单的(Hello World)WCF Web服务.根据我的阅读,您必须手动创建请求消息,然后将其发送到Web服务URL.

我能够在.asmx Web服务上完成此任务,但不能使用WCF服务.

我如何知道请求SOAP消息的正确格式?

我试图访问的Web服务格式为:http://xxx.xxx.xxx.xxx: PORT/IService1 /(在VM中本地运行)

我为缺乏信息而道歉,我很遗憾.

任何和所有的帮助非常感谢.

iphone wcf web-services objective-c

37
推荐指数
2
解决办法
8万
查看次数

MKMapView缩放到viewDidLoad上的用户位置?

我试图在视图加载后将地图缩放到用户的当前位置,但是我收到错误"***由于未捕获的异常终止应用程序'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)

iphone cocoa-touch objective-c

37
推荐指数
4
解决办法
3万
查看次数

在Xcode中创建和编辑plist文件的步骤

我想在中添加密钥对值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文件并在其中添加键值的步骤.提前致谢.

iphone xcode key-value plist ios

37
推荐指数
1
解决办法
6万
查看次数

WKWebView不在Xcode中

我需要使用Xcode为我的ios应用程序实现WKWebview.但是当我使用它"未声明的类型'WKWebview'"时我有错误.我错过了什么重要的东西.

我正在使用App Store中最新的Xcode7下载.

xcode wkwebview

37
推荐指数
5
解决办法
2万
查看次数

调度队列:如何判断它们是否正在运行以及如何阻止它们

我正在玩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)

cocoa multithreading objective-c grand-central-dispatch

33
推荐指数
2
解决办法
4万
查看次数

如何在iOS中发送Get请求?

我正在创建一个库来获取具有指定数据和方法类型的特定URL的响应.为此,我正在使用url提出请求.但是当我设置它的方法类型时,它显示了一个异常的无法识别的选择器发送,[NSURLRequest setHTTPMethod:] 我将其设置为

[requestObject setHTTPMethod:@"GET"];
Run Code Online (Sandbox Code Playgroud)

告诉我可能是什么问题.如果你有,也提供给我代码.

iphone url get objective-c nsurl

26
推荐指数
2
解决办法
7万
查看次数

CLLocationCoordinate2D到CLLocation

我在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)

请帮帮我,我被困了!

谢谢大家事先帮忙

iphone cocoa-touch cllocationmanager

24
推荐指数
3
解决办法
4万
查看次数

如何在Mac OS X上获取默认临时目录?

我想为某些单元测试创​​建一些数据目录,我希望这些目录位于用户的默认临时目录中.

我想在/ tmp下我可以创建一个子目录,但我不想假设有人建立了自己的机器.

我正计划动态编写测试数据,这就是为什么我想把它放到一个临时目录中.

macos cocoa test-data objective-c temporary-directory

23
推荐指数
4
解决办法
1万
查看次数

按降序排序数组(NSArray)

我有一个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)

这是正确的解决方案?有更好的解决方案吗?

cocoa objective-c

21
推荐指数
3
解决办法
3万
查看次数

Swift - 获取NSBundle用于测试目标?

在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)

nsbundle swift

21
推荐指数
1
解决办法
1万
查看次数