2015-10-02 1 views
0

Je rencontre une exception lorsque j'essaie de changer d'orientation. Je n'arrive pas à traverser cette exception. l'exception elle-même n'aide pas car elle continue à pointer sur la ligne de code qui me permet de changer d'orientation mais la description dit tenter d'insérer nil à partir d'objets [0] qui indique une erreur d'insertion dans un tableau. J'ai essayé le breakpoint et les instruments d'exception dans le débogage. aussi eu nszombie allumé. a également veillé à vérifier s'il est nul avant d'ajouter à un tableau ou d'initialiser un tableau. donc je ne sais plus quel pourrait être le problème ou quel genre d'action je ferais pour résoudre ce problème. quant au tableau, j'ai un tableau nommé arraydata qui est initialisé à viewdidload. quand il est nul et/ou compte < 1. J'appelle une réponse af qui remplit le tableau afin qu'il s'assure qu'il a du contenu. aussi les logs sont bien, il retourne count> 0 toujours. de toute façon j'espère que quelqu'un peut aider ici est l'exception. Merci à l'avanceModification de l'erreur d'orientation IOS

2015-10-02 21:40:18.801 NCR Video[4755:94868] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' 
*** First throw call stack: 
(
0 CoreFoundation      0x00000001126bdc65 __exceptionPreprocess + 165 
1 libobjc.A.dylib      0x0000000112356bb7 objc_exception_throw + 45 
2 CoreFoundation      0x0000000112582478 -[__NSPlaceholderArray initWithObjects:count:] + 360 
3 CoreFoundation      0x00000001125e1384 +[NSArray arrayWithObjects:count:] + 52 
4 UIKit        0x000000010ff6b83f _UIViewTopDownSubtreeTraversal + 127 
5 UIKit        0x000000011004aa57 -[UIViewController _replaceViewControllerInPresentationHierarchy:] + 120 
6 UIKit        0x000000011004a9a5 -[UIViewController _adaptedPresentationControllerForTraitCollection:withTransitionCoordinator:] + 430 
7 UIKit        0x000000011001f823 -[UIPresentationController _sharedParent:willTransitionToTraitCollection:withTransitionCoordinator:] + 273 
8 UIKit        0x000000011001f6f2 -[UIPresentationController _window:willTransitionToTraitCollection:withTransitionCoordinator:] + 37 
9 UIKit        0x000000011003dcaa -[UIViewController _window:willTransitionToTraitCollection:withTransitionCoordinator:] + 337 
10 UIKit        0x000000011003dcaa -[UIViewController _window:willTransitionToTraitCollection:withTransitionCoordinator:] + 337 
11 UIKit        0x000000011003dcaa -[UIViewController _window:willTransitionToTraitCollection:withTransitionCoordinator:] + 337 
12 UIKit        0x000000010ff5f891 -[UIWindow _rotateToBounds:withAnimator:transitionContext:] + 321 
13 UIKit        0x000000010ff61cb7 -[UIWindow _rotateWindowToOrientation:updateStatusBar:duration:skipCallbacks:] + 1741 
14 UIKit        0x000000010ff625fa -[UIWindow _setRotatableClient:toOrientation:applyTransformToWindow:updateStatusBar:duration:force:isRotating:] + 559 
15 UIKit        0x000000010ff6156e -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 116 
16 UIKit        0x000000010ff614f4 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 36 
17 UIKit        0x000000010ff613a1 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 122 
18 UIKit        0x000000010ff6043e __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 98 
19 UIKit        0x000000010ff6038e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 391 
20 UIKit        0x000000010ff607d0 -[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 316 
21 CoreFoundation      0x000000011268d54c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12 
22 CoreFoundation      0x000000011258ba04 _CFXNotificationPost + 2484 
23 Foundation       0x000000010fa4e968 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66 
24 UIKit        0x0000000110187e59 -[UIDevice setOrientation:animated:] + 282 
25 Foundation       0x000000010fa8db53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259 
26 NCR Video       0x000000010e44ea0b -[PlayRealStream toFullScreen] + 779 
27 NCR Video       0x000000010e454611 -[PlayRealStream fullscr:] + 177 
28 UIKit        0x000000010ff0fda2 -[UIApplication sendAction:to:from:forEvent:] + 75 
29 UIKit        0x000000011002154a -[UIControl _sendActionsForEvents:withEvent:] + 467 
30 UIKit        0x0000000110020919 -[UIControl touchesEnded:withEvent:] + 522 
31 UIKit        0x000000010ff5c998 -[UIWindow _sendTouchesForEvent:] + 735 
32 UIKit        0x000000010ff5d2c2 -[UIWindow sendEvent:] + 682 
33 UIKit        0x000000010ff23581 -[UIApplication sendEvent:] + 246 
34 UIKit        0x000000010ff30d1c _UIApplicationHandleEventFromQueueEvent + 18265 
35 UIKit        0x000000010ff0b5dc _UIApplicationHandleEventQueue + 2066 
36 CoreFoundation      0x00000001125f1431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
37 CoreFoundation      0x00000001125e72fd __CFRunLoopDoSources0 + 269 
38 CoreFoundation      0x00000001125e6934 __CFRunLoopRun + 868 
39 CoreFoundation      0x00000001125e6366 CFRunLoopRunSpecific + 470 
40 GraphicsServices     0x0000000114fd1a3e GSEventRunModal + 161 
41 UIKit        0x000000010ff0e900 UIApplicationMain + 1282 
42 NCR Video       0x000000010e42549f main + 111 
43 libdyld.dylib      0x00000001138bb145 start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

(lldb) 

initialisant le tableau à viewDidLoad

self.arrayData = [[NSMutableArray alloc]init]; 

à une méthode d'initialisation

if(StreamList!=nil && StreamList.count > 0) 
self.arrayData = [NSMutableArray arraywithArray:StreamList]; 

où streamlist est un NSArray contenant des objets

+0

[__NSPlaceholderArray initWithObjects: Nombre:] Il essaie de créer un tableau. Pouvez-vous mettre à jour votre message avec du code où vous initialisez ce tableau? Et le code dans lequel vous travaillez, ajoutez quelque chose. – Soberman

+0

@Soberman J'ai mis à jour le code avec l'initialisation. J'ajouterais aussi comment je l'ai utilisé mais il est si long que ça ne va pas. –

+0

@Soberman plus il y a beaucoup de tableaux utilisés. Y compris ceux des bibliothèques que j'utilise. Le tableau que j'ai inclus est celui utilisé pour la table. P.S Y at-il un moyen de savoir quelle variable/tableau est responsable de l'accident? –

Répondre

0

OK J'ai compris une solution pour vous. Il suffit de mettre en œuvre cette méthode exactement comme il est:

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {} 
+0

J'ai déjà fait cela indiqué par mon message & je cite "l'exception elle-même n'aide pas car elle pointe vers la ligne de code qui me permet de changer d'orientation mais la description dit tentative d'insertion nulle des objets [0] w/c eu une erreur dans l'insertion dans un tableau essayé exception breakpoint et instruments dans le débogage .nszombie avait activé. "même fait point d'arrêt symbolique pour" initWithObjects "c'est le code pointant vers NSNumber * value = [NSNumber numberWithInt: UIInterfaceOrientationLandscapeLeft]; [[UIDevice currentDevice] setValue: valeur forKey: @ "orientation"]; –

+0

J'ai mis à jour ma réponse pour vous, essayez-le, devrait aider à résoudre votre problème. – Soberman

+0

Je l'ai déjà à mon code. de toute façon merci beaucoup. Le problème est bizarre car il se produit la première fois que j'essaie de le changer en paysage. l'orientation à l'envers est bien cependant. Je pense que ce pourrait être un bug ou intégré avec ios. Je suis à peu près sûr que les tableaux de la classe principale et des autres classes ne sont pas impliqués. de toute façon merci encore! –