iOS 5 で問題なく動作するアプリケーションを持っていますが、iOS 4 で試してみると、EXC_BAD_ACCESS エラーが発生します。次のように AppDelegate に追加されたタブバーがあります。
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window.backgroundColor = [UIColor whiteColor];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
UITabBarController *tabBarController=[[UITabBarController alloc] init];
searchTableViewController = [[SearchTableViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *navControllerSearch=[[UINavigationController alloc] initWithRootViewController:searchTableViewController];
firstviewcontroller = [[FirstViewController alloc] initWithStyle:UITableViewStyleGrouped] ;
UINavigationController *navFirstView=[[UINavigationController alloc] initWithRootViewController:firstviewcontroller];
[[FirstViewController tableView] setScrollEnabled:NO];
secondViewController = [[SecondViewController alloc] initWithStyle:UITableViewStyleGrouped];
UINavigationController *navsecondView=[[UINavigationController alloc] initWithRootViewController:secondViewController];
[[SecondViewController tableView] setScrollEnabled:NO];
[tabBarController setViewControllers:[NSArray arrayWithObjects:navFirstView, navSecondView, navControllerSearch, nil]];
[self.window setRootViewController:tabBarController];
最初のタブから 2 番目のタブに移動しようとすると、アプリがクラッシュします。iOS 5 では問題なく動作します。iOS 展開対象プロパティは iOS 4.0 です。
Instruments を実行して Zombies を探すと、次の情報を持つ Zombie を見つけることができます。
# Address Category Event Type RefCt Timestamp Size Responsible Library Responsible Caller
1 0x5a21880 CALayer Zombie -1 00:10.816.545 0 QuartzCore -[CALayerArray copyWithZone:]
0 CoreFoundation ___forwarding___
1 CoreFoundation _CF_forwarding_prep_0
2 CoreFoundation CFRetain
3 CoreFoundation +[__NSArrayI __new::]
4 QuartzCore -[CALayerArray copyWithZone:]
5 CoreFoundation -[NSObject(NSObject) copy]
6 UIKit -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
7 UIKit -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
8 UIKit -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
9 UIKit -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
10 UIKit -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
11 UIKit -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]
12 UIKit -[UIView(Hierarchy) removeFromSuperview]
13 UIKit -[UITransitionView _didCompleteTransition:]
14 UIKit -[UITransitionView transition:fromView:toView:]
15 UIKit -[UITransitionView transition:toView:]
16 UIKit -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:]
17 UIKit -[UITabBarController transitionFromViewController:toViewController:]
18 UIKit -[UITabBarController _setSelectedViewController:]
19 UIKit -[UITabBarController _tabBarItemClicked:]
何か案は?