Crash on _CFArrayGetValueAtIndex when calling CGPathRelease on CGPath object - iphone

I'm getting a crash that I am completely stumped on, when releasing a CGPath object. The crash is occurring in the CoreTextHyperlinkView library at the end of the - (void)drawInContext:(CGContextRef)ctx bounds:(CGRect)bounds method in the JSCoreTextView class.
Basically it's using Core Graphics/Text to draw underlined text. It creates a path, draws it, then releases it.
Here is the relevant stack trace:
Thread 0 Crashed:
0 CoreFoundation 0x319058b6 _CFArrayGetValueAtIndex + 2
1 MyApp 0x00300891 -[JSCoreTextView drawInContext:bounds:] (JSCoreTextView.m:678)
2 MyApp 0x00300c5f -[JSCoreTextView drawRect:] (JSCoreTextView.m:709)
3 UIKit 0x337ded61 -[UIView(CALayerDelegate) drawLayer:inContext:] + 365
4 QuartzCore 0x3358f315 -[CALayer drawInContext:] + 113
5 QuartzCore 0x3358e8c3 CABackingStoreUpdate_ + 1779
6 QuartzCore 0x3358e037 CA::Layer::display_() + 975
7 QuartzCore 0x335850b7 CA::Layer::display_if_needed(CA::Transaction*) + 203
8 QuartzCore 0x33584fe1 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 25
9 QuartzCore 0x335849c3 CA::Context::commit_transaction(CA::Transaction*) + 239
10 QuartzCore 0x335847d5 CA::Transaction::commit() + 317
11 QuartzCore 0x33584639 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 61
12 CoreFoundation 0x3199b941 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 21
13 CoreFoundation 0x31999c39 __CFRunLoopDoObservers + 277
14 CoreFoundation 0x31999f93 __CFRunLoopRun + 747
15 CoreFoundation 0x3190d23d _CFRunLoopRunSpecific + 357
16 CoreFoundation 0x3190d0c9 _CFRunLoopRunInMode + 105
17 GraphicsServices 0x354ec33b _GSEventRunModal + 75
18 UIKit 0x338292b9 _UIApplicationMain + 1121
19 MyApp 0x0003fad7 main (main.m:13)
It seems like some array internal the the CGPath is causing the problem. Could this just be a Core Text or Core Graphics bug in iOS? I'm stuck as to how to go about investigating further as I can't look into the source code of the iOS SDK.
We only use this view in a modified BlockAlertView like this below example. We're getting the text from our JSON API in either english or arabic, which may contain email addresses or URLs to be underlineed and linkified.
JSCoreTextView *coreTextView = [[JSCoreTextView alloc] initWithFrame:CGRectMake(kAlertViewBorder, _height, frame.size.width-kAlertViewBorder*2, size.height)];
coreTextView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
coreTextView.delegate = self;
coreTextView.text = message;
coreTextView.textColor = _messageColor;
coreTextView.textAlignment = kCTCenterTextAlignment;
coreTextView.fontName = _messageFont.fontName;
coreTextView.fontSize = _messageFont.pointSize;
coreTextView.linkColor = _messageColor;
coreTextView.highlightedLinkColor = _messageLinkColor;
coreTextView.highlightColor = _messageColor;
coreTextView.backgroundColor = UIColor.clearColor;
coreTextView.underlined = YES;
[_view addSubview:coreTextView];

Related

Crash with MapKit on iOS 6

I have not been able to reproduce this particular crash myself but it has been reported via our crash reporting tool and is being experienced by several hundred of our users. Finding it hard to debug or reproduce.
It happens on all hardware platforms but only on iOS 6. Any help or insights will be highly appreciated.
Exception Type:SIGSEGVCode:SEGV_ACCERR
Fatal Exception
Thread 0 Crashed
0 MapKit _remove(objc_object*, MKQuadTrieNode*) + 13
1 MapKit -[MKQuadTrie remove:] + 54
2 MapKit -[MKAnnotationContainerView observeValueForKeyPath:ofObject:change:context:] + 252
3 Foundation NSKeyValueNotifyObserver + 272
4 Foundation NSKeyValueWillChange + 572
5 Foundation -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 180
6 Foundation NSKVOForwardInvocation + 130
7 CoreFoundation ___forwarding___ + 626
8 CoreFoundation _CF_forwarding_prep_0 + 24
9 MapKit -[MKUserLocation _updateCoordinate] + 106
10 MapKit -[MKUserLocation setLocation:] + 106
11 MapKit -[MKMapView(UserPositioningInternal) locationManagerUpdatedLocation:] + 994
12 CoreFoundation -[NSArray makeObjectsPerformSelector:withObject:] + 206
13 MapKit -[MKLocationManager _reportLocationStatus:] + 66
14 MapKit -[MKLocationManager locationProvider:didUpdateLocation:] + 1540
15 MapKit -[MKCoreLocationProvider locationManager:didUpdateLocations:] + 864
16 CoreLocation -[CLLocationManager onClientEventLocation:] + 1614
17 CoreLocation __CLClientInvokeCallback_block_invoke_0 + 64
18 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
19 CoreFoundation __CFRunLoopDoBlocks + 160
20 CoreFoundation __CFRunLoopRun + 1450
21 CoreFoundation CFRunLoopRunSpecific + 356
22 CoreFoundation CFRunLoopRunInMode + 104
23 GraphicsServices GSEventRunModal + 74
24 UIKit UIApplicationMain + 1120
25 App Name main.m line 14 main + 14
Try setting the delegate method of the locationManager to nil in the dealloc method of the class you are using it in
Something like this:
-(void) dealloc
{
self.locationManager.delegate = nil;
}
What might be happening is that the object is being deallocated (maybe due to low memory) and the location manager is trying to send a message to a non existing delegate.

ios core data NSFetchedResultsControllerDelegate crash

I am keep getting this error for NSFetchedResultsControllerDelegate.
not sure what to do with it, since it happen sporadically.
I do create the records synchronized, but still ..
any ideas why could this be?
- (Activity *)createActivityWithDictionary:(NSDictionary*)dict
{
#synchronized([DBController sharedManaged])
{
Activity *act = [Activity activityWithDictionary:dict inManagedObjectContext:self.managedObjectContext];
[self saveContext];
return act;
}
}
Date/Time: 2012-09-18 22:55:53.686 -0700
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3724188f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x34f46259 objc_exception_throw + 33
2 CoreFoundation 0x37244a9b -[NSObject doesNotRecognizeSelector:] + 175
3 CoreFoundation 0x37243915 ___forwarding___ + 301
4 CoreFoundation 0x3719e650 _CF_forwarding_prep_0 + 48
5 CoreData 0x36a78f4d -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 2401
6 Foundation 0x37aa64ff __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 19
7 CoreFoundation 0x3720d547 ___CFXNotificationPost_block_invoke_0 + 71
8 CoreFoundation 0x37199097 _CFXNotificationPost + 1407
9 Foundation 0x37a1a3eb -[NSNotificationCenter postNotificationName:object:userInfo:] + 67
10 CoreData 0x36a00839 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 77
11 CoreData 0x36a0031d -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 305
12 CoreData 0x36a09d01 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 1245
13 CoreData 0x369fd145 -[NSManagedObjectContext save:] + 201
14 PalFinds 0x000a57cb -[DBController saveContext] (DBController.m:75)
15 PalFinds 0x000a8dff -[DBController createActivityWithDictionaries:] (DBController.m:852)
16 PalFinds 0x00086649 -[PFMe finishRequest:andRestConnection:] (PFMe.m:1986)
17 PalFinds 0x0002e17d -[RestConnection connectionDidFinishLoading:] (RestConnection.m:326)
18 Foundation 0x37addc29 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 17
19 Foundation 0x37a356d9 -[NSURLConnectionInternalConnection invokeForDelegate:] + 29
20 Foundation 0x37a356a3 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 199
21 Foundation 0x37a355c5 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 61
22 CFNetwork 0x36ed97f5 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 193
23 CFNetwork 0x36ece4a5 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 425
24 CFNetwork 0x36ece599 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 669
25 CFNetwork 0x36ece599 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 669
26 CFNetwork 0x36ece1a3 URLConnectionClient::processEvents() + 107
27 CFNetwork 0x36ece0d9 MultiplexerSource::perform() + 157
28 CoreFoundation 0x37215ad3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
29 CoreFoundation 0x3721529f __CFRunLoopDoSources0 + 215
30 CoreFoundation 0x37214045 __CFRunLoopRun + 653
31 CoreFoundation 0x371974a5 CFRunLoopRunSpecific + 301
32 CoreFoundation 0x3719736d CFRunLoopRunInMode + 105
33 GraphicsServices 0x33956439 GSEventRunModal + 137
34 UIKit 0x30f43cd5 UIApplicationMain + 1081
35 PalFinds 0x000038bf main (main.mm:14)
36 PalFinds 0x00003878 start + 40
Looks like it's trying to call the delegate back and the delegate isn't implementing a method it's supposed to.
I'm thinking either controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: or controllerDidChangeContent:
Did you implement those methods in your NSFetchedResultsControllerDelegate?
I know this might seem far fetched BUT I had a very similar problem and I had all those methods implemented and then I realized I had my release commented out for the fetchedREsultsController...once I put that back in no more sigbart and works like a charm.
All I'm saying is that sometimes the error isn't always the obvious.
We would need to see a bit more code to figure it out. Thanks.

long press gesture issue

I have long press gesture in my app and it works good in ios 5.0 but in ios 4.3 i have exception. Here what i see in debug
[UILongPressGestureRecognizer initWithCoder:]: unrecognized selector sent to instance 0x5863360
2012-03-23 23:39:30.384 Woods2[289:ef03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILongPressGestureRecognizer initWithCoder:]: unrecognized selector sent to instance 0x5863360'
*** Call stack at first throw:
(
0 CoreFoundation 0x013415a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01ce6313 objc_exception_throw + 44
2 CoreFoundation 0x013430bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x012b2966 ___forwarding___ + 966
4 CoreFoundation 0x012b2522 _CF_forwarding_prep_0 + 50
5 UIKit 0x005bb9fd UINibDecoderDecodeObjectForValue + 2592
6 UIKit 0x005bb2f5 UINibDecoderDecodeObjectForValue + 792
7 UIKit 0x005bc6ac -[UINibDecoder decodeObjectForKey:] + 398
8 UIKit 0x004d0c54 -[UINib instantiateWithOwner:options:] + 834
9 UIKit 0x004d2ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
10 UIKit 0x00388628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
11 UIKit 0x00386134 -[UIViewController loadView] + 120
12 UIKit 0x0038600e -[UIViewController view] + 56
13 Woods2 0x00004f37 -[FirstViewController viewDidLoad] + 1671
14 UIKit 0x00386089 -[UIViewController view] + 179
15 UIKit 0x00398f54 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 120
16 UIKit 0x00397aaa -[UITabBarController transitionFromViewController:toViewController:] + 64
17 UIKit 0x003998a2 -[UITabBarController _setSelectedViewController:] + 263
18 UIKit 0x00399d5e -[UITabBarController viewWillLayoutSubviews] + 170
19 UIKit 0x004aa2e9 -[UILayoutContainerView layoutSubviews] + 226
20 QuartzCore 0x019faa5a -[CALayer layoutSublayers] + 181
21 QuartzCore 0x019fcddc CALayerLayoutIfNeeded + 220
22 QuartzCore 0x019a20b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
23 QuartzCore 0x019a3294 _ZN2CA11Transaction6commitEv + 292
24 UIKit 0x002d89c9 -[UIApplication _reportAppLaunchFinished] + 39
25 UIKit 0x002d8e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
26 UIKit 0x002e3617 -[UIApplication handleEvent:withNewEvent:] + 1533
27 UIKit 0x002dbabf -[UIApplication sendEvent:] + 71
28 UIKit 0x002e0f2e _UIApplicationHandleEvent + 7576
29 GraphicsServices 0x015eb992 PurpleEventCallback + 1550
30 CoreFoundation 0x01322944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
31 CoreFoundation 0x01282cf7 __CFRunLoopDoSource1 + 215
32 CoreFoundation 0x0127ff83 __CFRunLoopRun + 979
33 CoreFoundation 0x0127f840 CFRunLoopRunSpecific + 208
34 CoreFoundation 0x0127f761 CFRunLoopRunInMode + 97
35 UIKit 0x002d87d2 -[UIApplication _run] + 623
36 UIKit 0x002e4c93 UIApplicationMain + 1160
37 Woods2 0x00001c2a main + 170
38 Woods2 0x00001b75 start + 53
)
terminate called throwing an exceptionkill
Thank you very much for help
Here is the some code in viewdidload
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc]
initWithTarget:self action:#selector(handleLongPress:)];
lpgr.minimumPressDuration = 0.2; //user needs to press for 2 seconds
[mapView addGestureRecognizer:lpgr];
[lpgr release];
That trace data is much better formatted now. Now I see it's happening on the loadFromNib, not even when the user performs a long press. And it makes sense especially if the nib was copied in from another project.
Please see if you can find a gesture recognizer in your nib. If it's there, check the connections inspector. It might have some invalid references, possibly to symbols in another project. (You'll probably see a little "!" near one or more of the connections).
If you find that, then problem solved. Delete it, and use the GR you've set up in code. (or re-configure the pointers in the nib and comment out the code in viewDidLoad:).

Unable to trace an error

I'm trying to add an ad package on an app. I've done it on another project, it worked. But here I'm having a mysterious error, that never happened before. Could you help me to trace it ?
Could you help me to trace this error ?
2011-08-29 13:22:12.012 MeoCampus[45962:207] -[AdRequest initWithPageId:formatId:master:target:creator:request:requestDelegate:]: unrecognized selector sent to instance 0x633aa20
2011-08-29 13:22:12.015 MeoCampus[45962:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AdRequest initWithPageId:formatId:master:target:creator:request:requestDelegate:]: unrecognized selector sent to instance 0x633aa20'
*** Call stack at first throw:
(
0 CoreFoundation 0x018925a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x019e6313 objc_exception_throw + 44
2 CoreFoundation 0x018940bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01803966 ___forwarding___ + 966
4 CoreFoundation 0x01803522 _CF_forwarding_prep_0 + 50
5 MeoCampus 0x000a1e92 -[SASApi downloadAdWithFormatId:pageId:master:target:creator:timeout:] + 235
6 MeoCampus 0x000a7a64 -[SmartAdServerView loadFormatId:pageId:master:target:timeout:] + 401
7 MeoCampus 0x000a7ab3 -[SmartAdServerView loadFormatId:pageId:master:target:] + 71
8 MeoCampus 0x00004623 -[HomeViewController viewDidLoad] + 483
9 UIKit 0x00c57089 -[UIViewController view] + 179
10 UIKit 0x00c55482 -[UIViewController contentScrollView] + 42
11 UIKit 0x00c65f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
12 UIKit 0x00c64555 -[UINavigationController _layoutViewController:] + 43
13 UIKit 0x00c65870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
14 UIKit 0x00c6032a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
15 UIKit 0x00d7b2e9 -[UILayoutContainerView layoutSubviews] + 226
16 QuartzCore 0x00203a5a -[CALayer layoutSublayers] + 181
17 QuartzCore 0x00205ddc CALayerLayoutIfNeeded + 220
18 QuartzCore 0x001ab0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
19 QuartzCore 0x001ac294 _ZN2CA11Transaction6commitEv + 292
20 UIKit 0x00ba99c9 -[UIApplication _reportAppLaunchFinished] + 39
21 UIKit 0x00ba9e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
22 UIKit 0x00bb4617 -[UIApplication handleEvent:withNewEvent:] + 1533
23 UIKit 0x00bacabf -[UIApplication sendEvent:] + 71
24 UIKit 0x00bb1f2e _UIApplicationHandleEvent + 7576
25 GraphicsServices 0x02199992 PurpleEventCallback + 1550
26 CoreFoundation 0x01873944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
27 CoreFoundation 0x017d3cf7 __CFRunLoopDoSource1 + 215
28 CoreFoundation 0x017d0f83 __CFRunLoopRun + 979
29 CoreFoundation 0x017d0840 CFRunLoopRunSpecific + 208
30 CoreFoundation 0x017d0761 CFRunLoopRunInMode + 97
31 UIKit 0x00ba97d2 -[UIApplication _run] + 623
32 UIKit 0x00bb5c93 UIApplicationMain + 1160
33 MeoCampus 0x000023e9 main + 121
34 MeoCampus 0x00002365 start + 53
)
terminate called after throwing an instance of 'NSException'
Here is the code that create the ad:
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
//Intialize the SmartAdServerView object. This example is for a banner on the iPhone, you can specify any frame you want.
//By convention, banners have a ratio aspect of 6:1 in portrait mode, so if you have borders in your application, you should adapt the ad's height. The creative will be adapted to your view's frame, but it will look better if they have the same size.
//The iPad recommended height, with a 6:1 ratio is 128 pixels
SmartAdServerView *banner = [[SmartAdServerView alloc] initWithFrame:CGRectMake(.0,315.0,320.0,53.0) loader:SmartAdServerViewLoaderActivityIndicatorStyleWhite];
//Set an auto-resizing mask, for the view to adapt it's size when it's superview is resized (after a rotation for example). Typically a banner keep it's height and adapt it's width.
banner.autoresizingMask = UIViewAutoresizingFlexibleWidth;
//Set the banner to stay in place, so it won't be removed automatically.
banner.unlimited = YES;
//Set your ad's delegate, which will be the presentator of ad's modal view to the user, and will be notified of significative events
banner.delegate = self;
NSLog(#"set the delegate.");
NSLog(#"the delegate is = %#", [[banner delegate] class]);
//Load the ad with your settings
//The siteId can be a string in some rare cases, this is why you have to pass an NSString
//One ad per page of your application should have the "YES" for the "master" argument, and the other should have "NO", this is for page view counting.
//[banner loadFormatId:12345 pageId:#"98765" master:YES target:nil];
//Display the ad to the user, here we assume that we are in a UIViewController
[self.view addSubview:banner];
self.myAd = banner;
[banner release];
}
Thanks a lot.
I contacted the ad operator. Thanks you all.
Search for initWithPageId:formatId:master:target:creator:request:requestDelegate: method in your code. You are calling it for an object that does not recognize it.

Enumeration Mutation During UIView transitionWithView

I'm experience an occasional crash of my iPhone application where I'm getting the following exception
NSGenericException', reason: '*** Collection <CALayerArray: 0x26f6b0> was mutated while being enumerated.
With the stack trace on the crashing thread of
Thread 0 Crashed:
0 libSystem.B.dylib 0x00078ac8 __kill + 8
1 libSystem.B.dylib 0x00078ab8 kill + 4
2 libSystem.B.dylib 0x00078aaa raise + 10
3 libSystem.B.dylib 0x0008d03a abort + 50
4 libstdc++.6.dylib 0x00044a20 __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x00005958 _objc_terminate + 104
6 libstdc++.6.dylib 0x00042df2 __cxxabiv1::__terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x00042e46 std::terminate() + 10
8 libstdc++.6.dylib 0x00042f16 __cxa_throw + 78
9 libobjc.A.dylib 0x00004838 objc_exception_throw + 64
10 CoreFoundation 0x0009f850 __NSFastEnumerationMutationHandler + 208
11 libobjc.A.dylib 0x0000a51a objc_enumerationMutation + 18
12 UIKit 0x00007bfe -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 142
13 UIKit 0x00007c2e -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
14 UIKit 0x00007cd2 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:] + 22
15 UIKit 0x00007628 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 304
16 UIKit 0x000074e8 -[UIView(Hierarchy) addSubview:] + 16
17 UIKit 0x0006c350 +[UIViewControllerWrapperView wrapperViewForView:frame:] + 232
18 UIKit 0x00077d0c -[UINavigationController _startTransition:fromViewController:toViewController:] + 468
19 UIKit 0x00077abc -[UINavigationController _startDeferredTransitionIfNeeded] + 176
20 UIKit 0x00077a00 -[UINavigationController viewWillLayoutSubviews] + 8
21 UIKit 0x0006dca8 -[UILayoutContainerView layoutSubviews] + 132
22 UIKit 0x0000fbc0 -[UIView(CALayerDelegate) _layoutSublayersOfLayer:] + 20
23 CoreFoundation 0x0003e2e4 -[NSObject(NSObject) performSelector:withObject:] + 16
24 QuartzCore 0x0000f942 -[CALayer layoutSublayers] + 114
25 QuartzCore 0x0000f6fa CALayerLayoutIfNeeded + 178
26 QuartzCore 0x000094c4 CA::Context::commit_transaction(CA::Transaction*) + 204
27 QuartzCore 0x000092da CA::Transaction::commit() + 186
28 QuartzCore 0x0002d9b6 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 46
29 CoreFoundation 0x00030236 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 10
30 CoreFoundation 0x000300aa __CFRunLoopDoObservers + 406
31 CoreFoundation 0x000276b4 __CFRunLoopRun + 848
32 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
33 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
34 GraphicsServices 0x000045ec GSEventRunModal + 108
35 GraphicsServices 0x00004698 GSEventRun + 56
36 UIKit 0x0000411c -[UIApplication _run] + 396
37 UIKit 0x00002128 UIApplicationMain + 664
38 iDriveGreen 0x00003026 main (main.m:13)
39 iDriveGreen 0x00002ff0 start + 32
This crash is being triggered after the following code is executed.
StopRouteViewController *stopVC = [[StopRouteViewController alloc] init];
[UIView transitionWithView:self.navigationController.view
duration:0.5
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[self.navigationController pushViewController:stopVC animated:NO];
}
completion:NULL];
[stopVC release];
Does this look blatantly wrong to anyone? My current thought is that is is either tied to stopVC being released before it is pushed or with transitioning with navigationController.view while at the same time pushing a new viewController to the navigationController.
Since this only occurs occasionally, I'd like to have a little more confidence before I commit a potential fix.
Yes, this is incorrect usage of the API. -[UINavigationController pushViewController:animated:] handles animation on its own. Even if you pass NO as the second argument, it is still manipulating the view hierarchy, which is what's causing your crash.
Basically, there is no reason to put a call to -[UINavigationController pushViewController:animated:] in an animation block, as you have done. If you want to animate the push of your controller, pass YES as the second argument.