加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – 如何检查NSURLConnection给你回复的URL?

发布时间:2020-12-14 19:10:40 所属栏目:百科 来源:网络整理
导读:在iOS5之前我可以测试看看我从我的代码获得响应的URL是这样的: - (void)connectionDidFinishLoading:(NSURLConnection *)connection { returnString = [[[NSMutableString alloc] initWithData:responseData encoding: NSUTF8StringEncoding] autorelease];
在iOS5之前我可以测试看看我从我的代码获得响应的URL是这样的:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection 
{
    returnString = [[[NSMutableString alloc] initWithData:responseData encoding: NSUTF8StringEncoding] autorelease];
    NSString * currentParseString = [NSString stringWithFormat:@"%@",connection];
    NSLog(@"Currently Parsing: %@",currentParseString);
}

我的日志会打印出“Currently Parsing:http://www.myinfo.com/parser ….”

然后,我可以使用它来测试和发送到不同的IF语句.我现在的问题是,在iOS5中,连接不再作为URL打印,而是打印为内存块< NSURLConnection:0x6a6b6c0>我怎么能让它再次作为URL打印出来,所以我不必重写我的IF语句?

解决方法

我做了这样的事情:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection 
{
   NSLog(@"%@",[connection currentRequest]);
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读