【问题标题】:Multithread in NSURLConnection?NSURLConnection 中的多线程?
【发布时间】:2011-04-29 07:15:42
【问题描述】:

当我们使用 NSURLConnection 时,我们只需要实现代理 API

- (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data

接收数据。如果网络返回数据需要很长时间,这些人员不应该留在主线程。所以我们应该采取异步模式。

NSURLConnection 后面一定有多线程实现,对吗?如果没有,你怎么看?

【问题讨论】:

  • 为什么不希望它停留在主线程中?我的意思是可能导致什么问题?

标签: ios multithreading asynchronous nsurlconnection


【解决方案1】:

NSURLConnection 应该在主线程中启动。请参考以下链接http://developer.apple.com/library/ios/#qa/qa1712/_index.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多