2011-09-23 51 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];