当多个文件“同时写入文件”时,应用程序崩溃

问题描述:

这是我的代码。当多个文件“同时写入文件”时,应用程序崩溃

- (void) connectionDidFinishLoading: (NSURLConnection *) connection 

{ 
    //Each connection has its own "downloadedData". 
    BOOL writeFlag = [downloadedData writeToFile: filePath atomically: YES]; 
} 

我在同一time.Each连接多个NSURLConnections对应一个下载时多次下载同一time.Is完成这个方法的线程安全item.App崩溃?

它说:

_serverConnectionDiedNotification. Info -- notification=NSConcreteNotification 0x11d90470{name = AVController_ServerConnectionDiedNotification; object = <AVController: 0x11d855a0>}, 
AVController = <AVController: 0x11d855a0>,currentTime = 0.00 

Program received signal: “0”. 
warning: check_safe_call: could not restore current frame 

谢谢!

好吧,我弄清楚自己。除了下载的数据,我有几个数组和字典与每个独特的连接对。好像我没有仔细照顾那些藏品。 当我清除了这个混乱,phew,问题都消失了!

我假设downloadData不是在不同的请求之间共享的?因为这可能不是一个好主意。

我使用ASI-HTTPRequest库来满足我的http请求需求。正确执行异步请求等操作非常简单。你可能会觉得它很有用。

+0

不,每个连接都有自己的“downloadedData”。尽管如此,感谢ASI-HTTPRequest库的提示。 – 2009-07-16 08:36:52