My app uses ARC and I’ve got into trouble with some third party software that doesn’t use it.
I can get over that by setting -fno-objc-arc in the build phase. However I am left with a problem where one ViewController crashes the pp because it gets called twice.
I will try to explain…
In my own TableView I select a line which bring on Urban Airship’s StoreFront.
It comes on as a Modal window, as far as I can see.
It’s a TableView that directly get pointed to the DetailView of the item that I selected in my TableView. I buy the item and it starts downloading.
I have a delegate from Urban Airship that tells me in my TableView when the item is safely down on the phone. I [self dismissModalViewControllerAnimated:YES]; the UAStore at the end of that delegate in my own TableView and get my TableView back.
All working just fine.
The problem occurs when I select a new product to buy.
I get ll the way to the UA DetailView, but once I hit the “buy” button the app crashes.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported (<UAProductDetailViewController: 0x3a35e0>)'
To me it looks like the UAProductDetailViewController is not released. Urban Airship’s implementation files are in a library, so they are not available to tweak.
I’ve tried many different things to get out of here.
[[DataModel sharedModel] saveContext];
[[self tableView] reloadData];
// LessonListViewController *lessonListVC = [[LessonListViewController alloc] initWithNibName:@"LessonListView" bundle:nil];
UserData *UserData_Array = [dm.UserData_Array objectAtIndex:0];
// lessonListVC.courseID = UserData_Array.current_levelName;
// lessonListVC.lessonsArray = UserData_Array.current_level;
NSLog(@"Current level name:%@",UserData_Array.current_levelName);
NSLog(@"Lessons array:%@",UserData_Array.current_level);
// lessonListVC.navigationItem.hidesBackButton = YES;
// [self.navigationController popToViewController:lessonListVC animated:YES];
// [UAProductDetailViewController removeFromParentViewController];
self.tabBarController.tabBar.hidden = NO;
[self dismissModalViewControllerAnimated:YES];
But nothing has worked so far.
Hopefully someone can follow my somewhat mixed up description and save by hair.
** A NSLog call in the UADetailViews’s viewDidUnload does not get called when I’m back to my own TableView.
It would be helpful to see the code block where you dismiss the modal view controller with:
That doesn’t look quite right to me, since if you’re calling it in a delegate method implementation, “self” would refer to your object. If you’re receiving a reference to their view controller through the delegate method, try using that to dismiss it. If you try to dismiss it from your own view controller, and you’re running iOS 5.0, you need to be referencing using presentingViewController rather than parentViewController, e.g.: