【发布时间】:2011-09-23 20:11:33
【问题描述】:
我在 performInvocation: 方法的 ASIHTTPRequest 中遇到了崩溃。
堆栈是:
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 保留参数];
返回 performSelector:... 就在 [cbInvocation performSelectorOnMainThread:...] 调用之前。但这似乎并不具有权威性,而且我不确定我是否理解那里发生的事情足以做出和/或信任这种改变。我无法在本地重现该问题,但我从现场收到了大量带有此堆栈跟踪的崩溃报告。
顺便说一句,这是在 iOS 代码上。
有人知道这可能是什么吗?
【问题讨论】:
标签: objective-c ios4 asihttprequest