mach_msg_trap + 20
frame #0: 0x351b9010 libsystem_kernel.dylib
mach_msg_trap + 20
帧#1:0x351b920c libsystem_kernel.dylib mach_msg + 56
frame #2: 0x33672422 CoreFoundation
CFRunLoopServiceMachPort + 126
帧#3:0x3367115a CoreFoundation __CFRunLoopRun + 882
frame #4: 0x335f44dc CoreFoundation
CFRunLoopRunSpecific + 300
帧#5:0x335f43a4 CoreFoundation CFRunLoopRunInMode + 104
frame #6: 0x30e8cbc8 Foundation
+ [NSURLConnection(Loader) resourceLoadLoop:] + 308
第7帧:0x30e8ca90基金会-[NSThread main] + 72
frame #8: 0x30f205a0 Foundation
_NSThread__main + 1048
第9帧:0x3709bc1c libsystem_c.dylib`_pthread_start + 320 我没有使用ASINetworkQueue并使用url数组,我已经实现了requestFinished:方法,被称为罚款。当请求没有响应时,我收到了崩溃。
你可以请一些人帮帮我吗?示例代码段:
A类(Wrapper类扩展ASIHTTPRequest):
ASIHTTPRequest *httpRequest;
- (id)initWithURL:(NSString *)anURL errorInfo:(NSError **)error {
if (self = [super init]) {
NSURL *httpURL = [NSURL URLWithString:anURL];
httpRequest = [self createASIRequest:httpURL];
didFinishSelector = @selector(requestFinished:);
didFailSelector = @selector(requestFailed:);
return self;
}
}
- (void)dealloc {
if (httpRequest) {
[httpRequest clearDelegatesAndCancel];
[httpRequest release];
httpRequest = nil;
}
[super dealloc];
}
- (ASIHTTPRequest *)createASIRequest:(NSURL *)url {
ASIHTTPRequest *request = [[ASIHTTPRequest requestWithURL:url] retain];
request.delegate = self;
return request;
}
B组:
Request in loop:
Class A *d = [[Class A alloc] initWithURL:url errorInfo:&pError];
d.didFinishSelector = @selector(responseHandler:);
d.didFailSelector = @selector(responseHandler:);
答案 0 :(得分:1)
在释放视图控制器后调用委托方法。因此,需要在释放视图控制器之前清除所有代理。这对我有用。