J'ai donc un Controller UITabView qui a été créé dans l'interface builder. Les propriétés title et image de UITabBarItem ont été définies dans IB. Un objet Controller Tab Tab est présent dans le xib et toutes les connexions nécessaires sont faites. Je suis capable d'appeler des commandes simples telles queUITabBar - setItems: animated: Crashes
[tabBarController setSelectedIndex: 1]; Tout fonctionne correctement, mais lorsque je définis la propriété 'items', je plante. Peut-être que j'ai un problème de gestion de la mémoire?
Voici le code plantage:
NSMutableArray *modifiedItems = [[tabBarController.tabBar items] mutableCopy];
[modifiedItems removeObjectAtIndex:2];
NSArray *newItems = [[NSArray alloc] initWithArray:modifiedItems];
-->[tabBarController.tabBar setItems:newItems animated:NO];
* Mettre fin application en raison d'une exception non interceptée « NSInternalInconsistencyException », motif: « modifier directement une barre d'onglets géré par un contrôleur de barre d'onglets est pas autorisé. » * pile d'appel au premier coup:
0 CoreFoundation 0x02b9bb99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02ceb40e objc_exception_throw + 47
2 CoreFoundation 0x02b54238 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x02b541aa +[NSException raise:format:] + 58
4 UIKit 0x005f7019 -[UITabBar setItems:animated:] + 2037
5 Zag Map 0x00003422 -[ZagMapAppDelegate iPodTouchRemoval] + 270
6 Zag Map 0x00002eea -[ZagMapAppDelegate applicationDidFinishLaunching:] + 551
7 UIKit 0x003faf80 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1252
8 UIKit 0x003fd3b0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346
9 UIKit 0x004073ec -[UIApplication handleEvent:withNewEvent:] + 1958
10 UIKit 0x003ffb3c -[UIApplication sendEvent:] + 71
11 UIKit 0x004049bf _UIApplicationHandleEvent + 7672
12 GraphicsServices 0x03357822 PurpleEventCallback + 1550
13 CoreFoundation 0x02b7cff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x02add807 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x02adaa93 __CFRunLoopRun + 979
16 CoreFoundation 0x02ada350 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x02ada271 CFRunLoopRunInMode + 97
18 UIKit 0x003fcc6d -[UIApplication _run] + 625
19 UIKit 0x00408af2 UIApplicationMain + 1160
20 Zag Map 0x00002ca0 main + 102
21 Zag Map 0x00002c31 start + 53
terminate called after throwing an instance of 'NSException'
Mon NSArray et NSMutableArray semblent être bien vu qu'ils sont venus tout droit du UITabBar fonctionnement. Il a retourné trois objets, puis deux. J'espère juste oublier quelque chose de stupide ici. Toutes les idées que j'apprécierais vraiment.
Pouvez-vous obtenir un message d'exception? Cela aiderait vraiment je pense. – tia
Cliquez sur "breakpoints" puis sur "build and debug". Quand il se bloque, il y aura une erreur plus détaillée qui vous dira avec plus d'informations sur ce qui ne va pas. –