I am using MGSplitViewController in my application. From the one viewcontroller, On a button click, I have navigated control to these two methods where Formsheet will open with the background of MGSplitViewController (showing Master and Detail Views.)
These methods work well and I am getting the required result, but after many operations, the app crashes over this point without printing any log. Can anyone suggest me some solution?
-(void)launchSplitViewWithFormSheet :(MGSplitViewController *)mGSplitViewController
{
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mGSplitViewController];
[self.baseNavigationController setViewControllers:[NSArray arrayWithObject:navController]];
[self openFormSheet:mGSplitViewController];
}
-(void)openFormSheet:(MGSplitViewController *)mGSplitViewController
{
DetailViewController *detailViewController = (DetailViewController *)[mGSplitViewController.viewControllers objectAtIndex:0];
MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
UINavigationController *baseNavController = [[UINavigationController alloc]initWithRootViewController:masterViewController];
detailViewController.masterViewController = detailViewController;
baseNavController.modalPresentationStyle = UIModalPresentationFormSheet;
[mGSplitViewController presentModalViewController:baseNavController animated:YES];
}
I myself got the answer. Instead of
[self openFormSheet:mGSplitViewController];
I called up the function with thread using
[self performSelectorOnMainThread:@selector(openPurpose:) withObject:mGSplitViewController waitUntilDone:YES];
and I am not getting random crash. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With