2011-11-17 99 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作爲罪魁禍首。