现在的位置: 首页 > 综合 > 正文

dataWithContentsOfURL and HTTP 302 redirects

2013年12月09日 ⁄ 综合 ⁄ 共 516字 ⁄ 字号 评论关闭

Never use [NSData dataWithContentsOfURL:] in a real app. It makes a synchronous network connection and your app will be killed by the OS if that doesn't finish quickly enough.

Stick to NSURLConnectionDataDelegate or use [NSURLConnection sendAsynchronousRequest:queue:completionHandler:.

I ended up using [NSURLConnection sendAsynchronousRequest:queue:completionHandler:]. I've discovered multi-threading now. For the record, NSURLConnection does
handle 302s properly. –

link:http://stackoverflow.com/questions/9584663/datawithcontentsofurl-and-http-302-redirects

抱歉!评论已关闭.