如何获得 php web method的返回

clear_zero 2015-12-15 07:42:34
我有个php web method返回(比如 url = "",yes 或者 no

在xcode7里面怎么写才能取得返回值呢,我写了如下代码。但是没得到东西

NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.test.com/test.php?variable=test1"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
NSMutableData *receivedData = [NSMutableData data];
NSString *strData = [[NSString alloc]initWithData:receivedData encoding:NSUTF8StringEncoding];
NSLog(@"This is the response: %@", strData);
}else {
}



求指点,谢谢
...全文
117 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
conan_o_0 2015-12-17
  • 打赏
  • 举报
回复
你创建了一个receiveData 但是receiveData没有赋值?

29,027

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧