【发布时间】:2016-02-23 12:48:25
【问题描述】:
NSString *urlString = [NSString
stringWithFormat:@"http://192.168.1.15/abc/service.asmx?op=GetCenter"];
NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSData *data = [[NSData alloc] initWithContentsOfURL:url];
NSError *error;
NSMutableArray *json =[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSLog(@"%@",[json description]);
我已经尝试过了,但它返回调用函数的空值。
Program ended with exit code: 9(lldb)
如何识别是否调用了webserver或者如何调用该函数?
【问题讨论】:
-
应用程序是自动死机,还是您正在杀死它?返回给您的
error是什么? -
退出代码表明您的应用程序已被杀死
-
@SmitSaraiya 您没有请求该网址的数据。你需要使用 NSURLRequest
-
或者如果你想制作第三方 AFNetworking 库,那么 stackoverflow.com/questions/22851646/…
标签: ios json web-services