2011-11-17 67 views
0

我在我的iPhone应用程序中使用AdWhirl,我在几个不同的视图中显示adView。每个视图都有不同的adView ivar。问题是,当我快速切换视图时,Adwhirl代码中的ASIHttpRequest尝试在视图释放后调用视图。我曾尝试在我的观点中将代表设置为零,但无济于事。是否有任何其他解决方法可以取消分配视图时的AdWhirl ASIHttpRequest。在我看来的dealloc我做这样的事情:Adwhirl ASIHttpRequest崩溃iPhone

adView.delegate = nil; 
adView = nil 

其中AdView的声明像伊娃:

@property (nonatomic, retain) AdWhirlView *adView; 

崩溃日志:

Exception Type: EXC_BAD_ACCESS (SIGBUS) 
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000c 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libobjc.A.dylib     0x32ad5c98 objc_msgSend + 16 
1 SocialMashup     0x0005503c -[ASIHTTPRequest requestReceivedResponseHeaders:] (ASIHTTPRequest.m:1954) 
2 CoreFoundation     0x36387efc -[NSObject(NSObject) performSelector:withObject:] + 16 
3 Foundation      0x32cfe7a2 __NSThreadPerformPerform + 262 
4 CoreFoundation     0x363f1a72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6 
5 CoreFoundation     0x363f3758 __CFRunLoopDoSources0 + 376 
6 CoreFoundation     0x363f44e4 __CFRunLoopRun + 224 
7 CoreFoundation     0x36384ebc CFRunLoopRunSpecific + 224 
8 CoreFoundation     0x36384dc4 CFRunLoopRunInMode + 52 
9 GraphicsServices    0x30cdd418 GSEventRunModal + 108 
10 GraphicsServices    0x30cdd4c4 GSEventRun + 56 
11 UIKit       0x3037cd62 -[UIApplication _run] + 398 
12 UIKit       0x3037a800 UIApplicationMain + 664 
13 ZFirewall.dylib     0x013dcb24 0x13cd000 + 64292 
14 SocialMashup     0x000024ae main (main.m:17) 
15 SocialMashup     0x00002444 start + 32 
+1

self.adView.delegate = nil;和self.adView = nil;使用属性访问它。后崩溃日志 – 0x8badf00d

+0

我添加了崩溃日志。还有什么区别self.adView.delegate = nil;只是adview.delegate =零; – apy

+0

由于EXC_BAD_ACCESS而崩溃,将环境变量NSZombieEnabled设置为YES并开始调试。使用self.adView.delegate = nil;你正在访问属性,其中adView.delegate = nil你正在访问实例变量(如果你在@interface AdWhirlView * adView中有实例变量;那么它很好,但它的推荐是为了可读性使用self。明显) – 0x8badf00d

回答

0

我敢肯定的AdWhirl没有按”根本不使用ASIHTTPRequest。也许你正在使用一个特定的广告网络,但这些日志似乎并不指向AdWhirl作为罪魁祸首。