iphone - Frequently asihttprequest runrequests crash -
- thread #7: tid = 0x2403, 0x351b9010 libsystem_kernel.dylib
mach_msg_trap + 20 frame #0: 0x351b9010 libsystem_kernel.dylib
mach_msg_trap + 20 frame #1: 0x351b920c libsystem_kernel.dylibmach_msg + 56 frame #2: 0x33672422 corefoundation
cfrunloopservicemachport + 126 frame #3: 0x3367115a corefoundation__cfrunlooprun + 882 frame #4: 0x335f44dc corefoundation
cfrunlooprunspecific + 300 frame #5: 0x335f43a4 corefoundationcfrunloopruninmode + 104 frame #6: 0x30e8cbc8 foundation
+[nsurlconnection(loader) resourceloadloop:] + 308 frame #7: 0x30e8ca90 foundation-[nsthread main] + 72 frame #8: 0x30f205a0 foundation
_nsthread__main + 1048 frame #9: 0x3709bc1c libsystem_c.dylib`_pthread_start + 320
i not using asinetworkqueue , using through array of urls, , have implemented requestfinished: method, gets called fine. got received crash when request not responded.
could please 1 me out ?
sample code snippet :
class (wrapper class extends 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; }
class b :
request in loop: class *d = [[class alloc] initwithurl:url errorinfo:&perror]; d.didfinishselector = @selector(responsehandler:); d.didfailselector = @selector(responsehandler:);
the delegate methods being called after view controller has been released. so, needs clean delegates before releasing view controller.this works me.
Comments
Post a Comment