Reputation: 1004
I've got an application with UITableView nested in a UITabBarController, and I have a method that's giving me an EXC_BAD_ACCESS when it's called from UIActionSheetDelegate method clickedButtonAtIndex:
The method that (sometimes) gives a problem is called updateTaskArray. Basically, it does a Core Data fetch that configures an NSMutableArray "taskArray" that's a property of the viewController (which the tableView delegate uses to configure its cells) then its last line is
[self.tableView reloadData];
The thing is, it works fine most of the time, but it only gives an error when it's called from the UIActionSheetDelegate. When I run it with NSZombieEnabled, it tells me
*** -[UITabBarButton setAlpha:]: message sent to deallocated instance 0x5c2e760
And with breakpoints, it doesn't give EXC_BAD_ACCESS until after the UIActionView delegate method (and updateTaskArray within it) complete. The UIActionSheet is presented with:
[actionSheet showFromTabBar:self.tabBarController.tabBar];
so I'm wondering if this means that it's dismissing the actionSheet that is causing the problem... but it doesn't give any error if I don't call updateTaskArray from the delegate...
I'm not really sure what would be a good next step as [UITabBarButton setAlpha:] isn't a method I'm calling "myself" and the error seems to occur after the code I've actually "written" has already run- any suggestions on where to start approaching this one?
Upvotes: 3
Views: 1024
Reputation: 1004
I changed
[actionSheet showFromTabBar:self.tabBarController.tabBar];
to
[actionSheet showFromToolbar:self.navigationController.toolbar];
And it now works fine. The tabBarController is the parent of the navigation controller, I reckon it didn't like me going one level above.
Upvotes: 2
Reputation: 19789
Look at your release statements. You are releasing a UITabBarButton, or possibly the entire tab bar, when you shouldn't. Review principles of memory management for iOS.
Upvotes: 0