0

I am using AdWhirl in my iphone app and I am displaying the adView in several different views. Each view has a different adView ivar. Problem is that when I am switching the views quickly, ASIHttpRequest within Adwhirl code tries to call the view after the view has been deallocted. I have tried setting the delegate to nil in my view but to no avail. Are there any other workarounds to cancel the AdWhirl ASIHttpRequest when the view is deallocated. In my view dealloc I am doing something like:

adView.delegate = nil;
adView = nil

where adView is an ivar declared like:

@property (nonatomic, retain) AdWhirlView *adView;

Crash Log:

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
apy
  • 67
  • 2
  • 6
  • 1
    self.adView.delegate = nil; and self.adView = nil; access it using property. Post crash logs – 0x8badf00d Nov 17 '11 at 11:29
  • I added crash logs. Also what is the difference between self.adView.delegate = nil; and just adview.delegate=nil; – apy Nov 17 '11 at 20:03
  • crashed because of EXC_BAD_ACCESS, set environment variable NSZombieEnabled to YES and start debugging. using self.adView.delegate = nil; you are accessing property where as adView.delegate = nil you are accessing instance variable (If you have instance variable in @interface AdWhirlView *adView; then its fine, but its recommended for readability to use self. when accessing through property that way its more obvious) – 0x8badf00d Nov 17 '11 at 20:45
  • I'm trying to find where AdWhirl uses ASIHttpRequest specifically. Is this a part of the request AdWhirl is making for an ad or are you using ASIHttpRequest for something else? – RajPara Nov 21 '11 at 18:51
  • I think ASIHttpRequest is used by AdWhirl internally to request ads asynchronously. – apy Nov 27 '11 at 16:30

1 Answers1

0

I'm pretty sure AdWhirl doesn't use ASIHTTPRequest at all. Maybe a particular ad network you're using does, but the logs don't even seem to point to AdWhirl as the culprit.

Wes Goodman
  • 116
  • 3