Adwhirl ASIHttpRequest Crashing iPhone - iphone

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

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.

Related

Crash on [NSURLConnection releaseDelegate] in a function without NSURLConnections, how do I culprit?

Hullo,
I am experimenting a very vicious crash that shows up in the following way in the device logs:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x50000008
Crashed Thread: 0`
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x33b24c98 objc_msgSend + 16
1 Foundation 0x3429465a _NSURLConnectionReleaseClient + 30
2 CFNetwork 0x355ac608 ClientContextHolder<CFURLConnectionClient_V4>::forget() + 20
3 CFNetwork 0x355ac5ea URLConnectionClient::releaseClientLocked() + 34
4 CFNetwork 0x355a0e9a URLConnectionClient::processEvents() + 170
5 CFNetwork 0x355a0de2 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
6 CFNetwork 0x355a0d54 MultiplexerSource::perform() + 120
7 CFNetwork 0x355a0cd2 MultiplexerSource::_perform(void*) + 2
8 CoreFoundation 0x3039ca72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
9 CoreFoundation 0x3039e758 __CFRunLoopDoSources0 + 376
10 CoreFoundation 0x3039f4e4 __CFRunLoopRun + 224
11 CoreFoundation 0x3032febc CFRunLoopRunSpecific + 224
12 CoreFoundation 0x3032fdc4 CFRunLoopRunInMode + 52
13 GraphicsServices 0x35571418 GSEventRunModal + 108
14 GraphicsServices 0x355714c4 GSEventRun + 56
15 UIKit 0x358c7d62 -[UIApplication _run] + 398
16 UIKit 0x358c5800 UIApplicationMain + 664
17 inArrivo 0x000023ca main (main.m:14)
18 inArrivo 0x00002394 start + 32
After having enabled NSZombie I also have a crash on the compiler log of the following form:
2011-05-09 16:12:24.400 inArrivo[5019:707] * -[NSURLConnection releaseDelegate]: message sent to deallocated instance 0x5d61670
appearing on the app main with the last NSLog comeing from a function with no url connections. Also if I remove some pieces of very innocent code from that function, no crash occurs, and the same happens when I run the complete application on the simulator.
Could someone give me some hints about what I may do to locate the piece of code producing the crash? Normal debugging of course is of little help here.
Thanks,
Fabrizio Bartolomucci
The message indicates that the delegate for NSURLConnection was deallocated. I would suggest you check the delegate object to see if you are doing an extra release on it.

How to recognize errors from crash logs

My app works great when I build and debug but when I run on its own, it crashes due to some other issues.
I have one NSObject class, one UITableView class, one UIView class , one UITableViewCell class and one NSOperation class.
Does any body have similar issues or if any one can help me out.
Application Specific Information:
objc_msgSend() selector name: release
iPhone Simulator 235, iPhone OS 4.2 (iPhone/8C134)
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x01134a67 objc_msgSend + 27
1 UIKit 0x004ab1e2 -[UITableViewCell removeFromSuperview] + 167
2 UIKit 0x003249d9 -[UIView dealloc] + 340
3 UIKit 0x0032e281 -[UIScrollView dealloc] + 341
4 UIKit 0x003661ce -[UITableView dealloc] + 1085
5 Foundation 0x000698da __delayedPerformCleanup + 59
6 CoreFoundation 0x00f4bbde CFRunLoopTimerInvalidate + 446
7 CoreFoundation 0x00fb57d7 __CFRunLoopDoTimer + 1799
8 CoreFoundation 0x00f11cc9 __CFRunLoopRun + 1817
9 CoreFoundation 0x00f11240 CFRunLoopRunSpecific + 208
10 CoreFoundation 0x00f11161 CFRunLoopRunInMode + 97
11 GraphicsServices 0x01874268 GSEventRunModal + 217
12 GraphicsServices 0x0187432d GSEventRun + 115
13 UIKit 0x002fa42e UIApplicationMain + 1160
14 Time 0x00001e08 main + 102 (main.m:14)
15 Time 0x00001d99 start + 53
This technote has the technical info on crashlogs:
http://developer.apple.com/library/mac/#technotes/tn2004/tn2123.html
However, you are having a debugging problem, not a crashlog problem.
See tips for debugging here:
http://www.cocoadev.com/index.pl?DebuggingTechniques
Interpreting crash logs takes practice. People here see this: removeFromSuperview and immediately think "Aha, a clue! this is likely a memory issue" because removeFromSuperview will remove a view then decrement it's retain count. if the retain count is already zero, then decrementing one more time may lead to a crash. Thus, they think you are over releasing your UITableViewCell
check your UITableViewCell for alloc/init, release or autorelease...

iOS app crashing in Core Location callback machinery

I have problems analyzing my crashlog. The iPhone crashes sometimes, when I click on the app icon to start the app. The app is already "running" in background, but it's not active. This is the symbolized crash log:
Thread 0 Crashed:
0 libobjc.A.dylib 0x33479470 objc_msgSend + 28
1 CoreLocation 0x3436f68e -[CLLocationManager onClientEvent:supportInfo:] + 98
2 CoreLocation 0x3436f804 OnClientEvent + 16
3 CoreLocation 0x3436b522 CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
4 CoreLocation 0x3436cf74 CLClientHandleDaemonDataRegistration(__CLClient*, CLDaemonCommToClientRegistration const*, __CFDictionary const*) + 668
5 CoreLocation 0x3436d4c8 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 212
6 CoreFoundation 0x33a813fe __CFMessagePortPerform + 242
7 CoreFoundation 0x33a556f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
8 CoreFoundation 0x33a556bc __CFRunLoopDoSource1 + 160
9 CoreFoundation 0x33a47f76 __CFRunLoopRun + 514
10 CoreFoundation 0x33a47c80 CFRunLoopRunSpecific + 224
11 CoreFoundation 0x33a47b88 CFRunLoopRunInMode + 52
12 GraphicsServices 0x33b0e4a4 GSEventRunModal + 108
13 GraphicsServices 0x33b0e550 GSEventRun + 56
14 UIKit 0x32099322 -[UIApplication _run] + 406
15 UIKit 0x32096e8c UIApplicationMain + 664
16 Norddeich 0x00002764 main (main.m:14)
17 Norddeich 0x00002718 start + 32
As far as i understand the stack trace, the error occurred in the main.m. Line 14 is part of the default code:
int retVal = UIApplicationMain(argc, argv, nil, nil);
Please give me a hint, how to find the error.
Thank you in advance!
Do you set it's delegate to nil before returning from controller (or at least in controller's dealloc)? I suspect CLLocationManager is trying to send a message to delegate which is deallocated already - that's why it crashes at obj_msgSend.
I had this same problem testing my app on 4.3, but not in 5.0. The issue was that I was trying to dealloc the CLLocationManager inside one of the delegate methods. It works fine in 5.0, but crashes a iPhone 3GS running 4.3 every time.
In the end I made the CLLocationManager object a property, then in the delegate method set the delegate to nil and dispatched a block to the main thread to release the object.

popViewControllerAnimated:YES crashes my app

My app crashes when I do [self.navigationController popViewControllerAnimated:YES].
It crashes more on Device than on Simulator. Please suggest how to fix this?
Date/Time: 2010-11-09 10:51:41.325 +0800
OS Version: iPhone OS 4.0.1 (8A306)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000286e objc_msgSend + 18
1 CoreFoundation 0x00002c30 -[NSObject(NSObject) release] + 24
2 libobjc.A.dylib 0x00003c1a objc_setProperty + 114
3 UIKit 0x000693d4 -[UINavigationController setDisappearingViewController:] + 24
4 UIKit 0x0007d5c0 -[UINavigationController _clearLastOperation] + 40
5 UIKit 0x0007d4b4 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 556
6 UIKit 0x0007d248 -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:] + 204
7 UIKit 0x0007d0b6 -[UINavigationTransitionView _navigationTransitionDidStop] + 450
8 UIKit 0x00059974 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
9 UIKit 0x0005987e -[UIViewAnimationState animationDidStop:finished:] + 34
10 QuartzCore 0x000127ba run_animation_callbacks(double, void*) + 286
11 QuartzCore 0x0001265c CA::timer_callback(__CFRunLoopTimer*, void*) + 116
12 CoreFoundation 0x00071a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
13 CoreFoundation 0x00073ede __CFRunLoopDoTimer + 854
14 CoreFoundation 0x0007485e __CFRunLoopRun + 1082
15 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
16 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
17 GraphicsServices 0x000036e8 GSEventRunModal + 108
18 GraphicsServices 0x00003794 GSEventRun + 56
19 UIKit 0x000062a0 -[UIApplication _run] + 396
20 UIKit 0x00004e10 UIApplicationMain + 664
21 tenpay 0x00006124 main (main.m:13)
22 tenpay 0x00002324 start + 44
myviewcontroller = [[[MyViewController alloc]init]autorelease];
[self.navigationController pushViewController:myviewcontroller animated:YES];
[myviewcontroller release]; //This is my bug !!! I just fixed it.
This usually means you are sending a message to a released object which is a bad idea.
From the stack you can see that it is sending a release message to an object. I'd suggest that the object has already been released and thus hasa retain count of 0. Therefore a further release would be invalid.
I believe if you turn on a flag, I think it's called Zombie detection or something like that, then any message to a released object will generate a more descriptive message.
Perhaps a more experienced developer can jump in here with more details.
Yes, I believe Derek is pointing you in the right direction. Could you possibly list what kind of memory-related operations you are performing on the active controller before sending this release message (the release message is being sent implicitly when you try to pop it out). Please clarify if you are using autorelease for this controller,etc... Also it might be helpful to see what are the associated properties that you may have associated with this controller (ex: #property(nonatomic, retain, etc...)) if there are any.

I need help with a MKMapView crash

One of the most frequent crashes of my live app is a crash at MKMapView. It crash at the internal method -[MKMapView mapTileViewDidFinishLoading:]. During my test I could not retrace the crash but is very frequent in the crash reports on iTunes Connect. Has anyboday some experience with this crash? It is only a very simple map showing exactly one annotation.
Here is the complete stacktrace of this crash:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000009
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x339737d8 objc_msgSend + 16
1 MapKit 0x345709ec -[MKMapView mapTileViewDidFinishLoading:]
2 CoreFoundation 0x344492e4 -[NSObject(NSObject) performSelector:withObject:]
3 Foundation 0x3326981e __NSThreadPerformPerform
4 CoreFoundation 0x34460f1e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
5 CoreFoundation 0x34432ba0 __CFRunLoopDoSources0
6 CoreFoundation 0x34432444 __CFRunLoopRun
7 CoreFoundation 0x34432270 CFRunLoopRunSpecific
8 CoreFoundation 0x34432178 CFRunLoopRunInMode
9 GraphicsServices 0x3026b5ec GSEventRunModal
10 GraphicsServices 0x3026b698 GSEventRun
11 UIKit 0x31ad011c -[UIApplication _run]
12 UIKit 0x31ace128 UIApplicationMain
13 MYApp 0x00002e08 main + 36
14 MYApp 0x00002dd8 start + 32
I think I may have fixed this issue in my own application. It appears that this post has the correct solution and explanation.
The message that was causing the failure in my application was 'mapViewDidFinishLoadingMap' which is a message of the MKMapViewDelegate. Try to set the mapView delegate to 'nil' before in your views dealloc method.
Just do this it will solve the problem 100%
-(void) viewWillDisappear:(BOOL)animated
{
self.mapView.delegate = nil;
mapView=Nil;
NSLog(#"viewWillDisappear");
}
I also had to set the delegate to nil in viewDidDisappear to fix the issue.