Re: crashing on "-[UIViewController presentViewController:animated:completion:] " on ios 8
Re: crashing on "-[UIViewController presentViewController:animated:completion:] " on ios 8
- Subject: Re: crashing on "-[UIViewController presentViewController:animated:completion:] " on ios 8
- From: David Duncan <email@hidden>
- Date: Tue, 23 Sep 2014 11:25:52 -0700
> On Sep 23, 2014, at 11:19 AM, Herman Chan <email@hidden> wrote:
>
> Hi David,
>
> Yes, it was related to the PPRevealSideViewController, which I'll look into to see if I can fix it.
>
> However, I don't know if that's the problem with my original problem.
>
> That warning for detached view controller has been there for awhile through iOS 6 -> 7 and it has been fine for us and once it gets to iOS 8, we start seeing crash logs that I post before.
iOS 8 has gotten quite a bit more picky about these things, so things that were just warnings before may be hard crashes now. Also given how early you are crashing inside of objc_msgSend, that would typically indicate that you have a bad object (since one of the first things objc_msgSend does is dereference the object).
>
> Here it is again:
>
> Thread : Crashed: com.apple.main-thread
> 0 libobjc.A.dylib 0x34043f46 objc_msgSend + 5
> 1 UIKit 0x2a0f2739 -[UIPresentationController runTransitionForCurrentState] + 444
> 2 UIKit 0x2a107a0b -[UIViewController _presentViewController:presentationController:animationController:interactionController:completion:] + 822
> 3 UIKit 0x2a10899f -[UIViewController _presentViewController:withAnimationController:completion:] + 2850
> 4 UIKit 0x2a10a4ab __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 258
> 5 UIKit 0x29f07243 -[UIViewController presentViewController:animated:completion:] + 194
> 6 MyApp 0x00136441 -[LeftMenuViewController tableView:didSelectRowAtIndexPath:] (LeftMenuViewController.m:362)
> 7 UIKit 0x29f3d7c7 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 918
> 8 UIKit 0x29fef0df -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 194
> 9 UIKit 0x29ea11bd _applyBlockToCFArrayCopiedToStack + 308
> 10 UIKit 0x29e1d10b _afterCACommitHandler + 458
> 11 CoreFoundation 0x269505cd __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
> 12 CoreFoundation 0x2694dc8b __CFRunLoopDoObservers + 278
> 13 CoreFoundation 0x2694e093 __CFRunLoopRun + 914
> 14 CoreFoundation 0x2689c621 CFRunLoopRunSpecific + 476
> 15 CoreFoundation 0x2689c433 CFRunLoopRunInMode + 106
> 16 GraphicsServices 0x2dc4a0a9 GSEventRunModal + 136
> 17 UIKit 0x29e86809 UIApplicationMain + 1440
> 18 MyApp 0x000d9013 main (main.m:14)
>
> I have a feeling that it has something to do with the new addition of UIPresentationController in iOS 8. The real problem is that I can't seem to replicate this crash at all.
>
> My leading theory at the moment is that I am not setting modalPresentationStyle on the controller who's presenting the new view controller and somehow iOS 8 does not like it.
>
> Any help is appreciated.
>
> Herman
>
>
> On 23 Sep 2014, at 14:04, David Duncan wrote:
>
>>> On Sep 23, 2014, at 10:45 AM, Herman Chan <email@hidden> wrote:
>>>
>>> Hi David,
>>>
>>> Here is my set up in term of view controllers.
>>>
>>> - (void) setUpTabbarController {
>>>
>>> self.tabBarController = [[MyTabbarViewController alloc] init];
>>> ViewController *v1 = [[HubActivityViewController alloc] initWithNibName:nil bundle:nil];
>>> ViewController *v2 = [[CalendarContainerViewController alloc] initWithNibName:nil bundle:nil];
>>> ViewController *v3 = [[HubTaskGroupsViewController alloc] init];
>>>
>>> UINavigationController* nav1 = [[UINavigationController alloc] initWithRootViewController:v1];
>>> UINavigationController* nav2 = [[UINavigationController alloc] initWithRootViewController:v2];
>>> UINavigationController* nav3 = [[UINavigationController alloc] initWithRootViewController:v3];
>>>
>>> self.tabBarController.viewControllers = [NSArray arrayWithObjects:nav1, nav2, nav3, nil];
>>> nav1.delegate = self.tabBarController;
>>> nav2.delegate = self.tabBarController;
>>> nav3.delegate = self.tabBarController;
>>>
>>> self.revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:self.tabBarController];
>>> [self.revealSideViewController setDirectionsToShowBounce:PPRevealSideDirectionNone];
>>> [self.revealSideViewController setPanInteractionsWhenClosed:PPRevealSideInteractionContentView | PPRevealSideInteractionNavigationBar];
>>> [self.revealSideViewController setOption:PPRevealSideOptionsResizeSideView];
>>>
>>> self.window.rootViewController = self.revealSideViewController;
>>>
>>> // set the modal presenting style, possible fix for crash on iOS 8
>>> if ([Util isRunningIOSEight]) {
>>> self.window.rootViewController.modalPresentationStyle = UIModalPresentationOverFullScreen;
>>> }
>>> }
>>>
>>> We use a library called "PPRevealSideViewController" (https://github.com/ipup/PPRevealSideViewController/commits/master) to provide a slide menu in our app. Whenever we call [self presentViewController:] from on of the view controller inside the tabbarcontroller (i.e.: v1), we get the detached view controller warning.
>>>
>>> Do you think the warning is related to the menu library or the way I set up my tabbarcontroller?
>>
>> Simplest way to find out is to remove the PPRevealSideViewController view controller and see if the issues go away (or you can do this in a side project).
>>
>>>
>>> Herman
>>>
>>>
>>> On 23 Sep 2014, at 13:32, David Duncan wrote:
>>>
>>>>> On Sep 22, 2014, at 7:16 PM, Herman Chan <email@hidden> wrote:
>>>>>
>>>>> Hi Ben,
>>>>>
>>>>> I have both in my app, both presenting from rootVC and just plain controller. I fish out the rootVC to get rid of warning like this "Presenting view controllers on detached view controllers is discouraged”.
>>>>
>>>> So why do you have detached view controllers in the first place?
>>>>
>>>> Detached view controllers have been discouraged ever since it was possible to setup the parent-child relationship in the first place. I suspect that if you fix your detached view controllers that you will fix this issue too.
>>>>
>>>>>
>>>>> I am seeing crash logs from both instance of presenting view controllers (both from rootVC and not), so that's probably not the issue here.
>>>>>
>>>>> Herman
>>>>>
>>>>> On 22 Sep 2014, at 22:14, Ben Kennedy wrote:
>>>>>
>>>>>> On 22 Sep 2014, at 6:36 pm, Herman Chan <email@hidden> wrote:
>>>>>>
>>>>>>> GlobalSettingsViewController *c = [[GlobalSettingsViewController alloc] initWithGroupDataSource:self.dataSource];
>>>>>>> navigationController = [[UINavigationController alloc] initWithRootViewController:c];
>>>>>>> UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
>>>>>>> [vc presentViewController:navigationController animated:YES completion:nil];
>>>>>>
>>>>>> Is there a particular reason why you are fishing out the root view controller via the delegate singleton? Does it work properly if your LeftMenuViewController instance (the class which according to your trace is making the call) simply calls presentViewController on itself instead?
>>>>>>
>>>>>> b
>>>>>>
>>>>>> --
>>>>>> Ben Kennedy, chief magician
>>>>>> Zygoat Creative Technical Services
>>>>>> http://www.zygoat.ca
>>>>> _______________________________________________
>>>>>
>>>>> Cocoa-dev mailing list (email@hidden)
>>>>>
>>>>> Please do not post admin requests or moderator comments to the list.
>>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>>
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>
>>>>> This email sent to email@hidden
>>>>
>>>> --
>>>> David Duncan
>>
>> --
>> David Duncan
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden