2011-09-23 50 views
1

我在執行executeInvocation:方法的ASIHTTPRequest中發生崩潰。ASIHTTPRequest崩潰in performInvocation

堆棧是:

ASIHTTPRequest performInvocation:onTarget:releasingObject: 1877 
ASIHTTPRequest performSelector:onTarget:withObject:amount:callerToRetain: 1870 
ASIHTTPRequest updateProgressIndicator:withProgress:ofTotal: 1903 
ASINetworkQueue request:didReceiveBytes: 240 
ASIHTTPRequest performInvocation:onTarget:releasingObject: 1877 

這就是崩潰發生的方法:

+ (void)performInvocation:(NSInvocation *)invocation onTarget:(id *)target releasingObject:(id)objectToRelease 
{ 
    if (*target && [*target respondsToSelector:[invocation selector]]) { 
    [invocation invokeWithTarget:*target]; 
    } 
    CFRelease(invocation); 
    if (objectToRelease) { 
     CFRelease(objectToRelease); 
    } 
} 

我相信這是對invokeWithTarget通話發生。

這種情況很少發生,但在大規模部署中發生了很多事情。

在搜索周圍,我發現了一個模糊的參考添加:

[cbInvocation retainArguments];

回到performSelector:...正好在[cbInvocation performSelectorOnMainThread:...]調用之前。但這看起來似乎並不具有權威性,我不確定我是否已經足夠支持和/或相信這種變化。我無法在本地重現問題,但是我從該字段獲得大量帶有此堆棧跟蹤的崩潰報告。

這對iOS代碼,順便說一下。

任何人都知道這可能是什麼?

回答

0

您的downloadProgressDelegate已被釋放,而不是先從ASIHTTPRequest的downloadProgressDelegate中移除它。

在你的下載進度委託的dealloc實現,調用:

[request setDownloadProgressDelegate:nil];