Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在NSArray init坠毁_Ios_Objective C_Crash - Fatal编程技术网

Ios 在NSArray init坠毁

Ios 在NSArray init坠毁,ios,objective-c,crash,Ios,Objective C,Crash,我有一份事故日志,描述如下: Exception Type: SIGABRT Exception Codes: #0 at 0x3b694350 Crashed Thread: 0 Application Specific Information: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray init

我有一份事故日志,描述如下:

Exception Type:  SIGABRT  
Exception Codes: #0 at 0x3b694350  
Crashed Thread:  0  

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[124]'

Last Exception Backtrace:
0   CoreFoundation                      0x3346e2a3 __exceptionPreprocess (in CoreFoundation) + 163  
1   libobjc.A.dylib                     0x3b19697f objc_exception_throw (in libobjc.A.dylib) + 31  
2   CoreFoundation                      0x333b834d -[__NSPlaceholderArray initWithObjects:count:] (in CoreFoundation) + 165  
3   CoreFoundation                      0x333c6559 +[NSArray arrayWithObjects:count:] (in CoreFoundation) + 45  
4   CoreFoundation                      0x333d0869 -[NSDictionary allKeys] (in CoreFoundation) + 261  
5   SogouInputIPhone.dylib              0x06707df1 0x66e2000 + 155121  
6   SogouInputIPhone.dylib              0x066e5533 0x66e2000 + 13619  
7   CoreFoundation                      0x333bf037 _CFXNotificationPost (in CoreFoundation) + 1427  
8   Foundation                          0x33cd5599 -[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation) + 73  
9   UIKit                               0x35301121 -[UIApplication _handleApplicationSuspend:eventInfo:] (in UIKit) + 817  
10  UIKit                               0x352771e7 -[UIApplication handleEvent:withNewEvent:] (in UIKit) + 2459  
11  UIKit                               0x352766cd -[UIApplication sendEvent:] (in UIKit) + 73  
12  UIKit                               0x3527611b _UIApplicationHandleEvent (in UIKit) + 6155  
13  GraphicsServices                    0x36f8e5a3 _PurpleEventCallback (in GraphicsServices) + 591  
14  GraphicsServices                    0x36f8e1d3 PurpleEventCallback (in GraphicsServices) + 35  
15  CoreFoundation                      0x33443173 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ (in CoreFoundation) + 35  
16  CoreFoundation                      0x33443117 __CFRunLoopDoSource1 (in CoreFoundation) + 139  
17  CoreFoundation                      0x33441f99 __CFRunLoopRun (in CoreFoundation) + 1385  
18  CoreFoundation                      0x333b4ebd CFRunLoopRunSpecific (in CoreFoundation) + 357  
19  CoreFoundation                      0x333b4d49 CFRunLoopRunInMode (in CoreFoundation) + 105  
20  GraphicsServices                    0x36f8d2eb GSEventRunModal (in GraphicsServices) + 75  
21  UIKit                               0x352ca301 UIApplicationMain (in UIKit) + 1121  
22  MyApp                               0x0000f94b main (in MyApp) (main.m:26)  
23  libdyld.dylib                       0x3b5cdb20 start (in libdyld.dylib) + 0  

我已经检查了我的代码,没有使用NSArray。运行循环似乎在调度触摸事件并生成NSArray,但我不确定它以及导致崩溃的原因。

您不能将nil插入
NSArray
,如果您想将占位符对象放入数组中,可以使用
[NSNull]
。问题的解决方案是找到要插入的nil对象并避免插入它,或者先alloc/init它,然后插入


如果您发布代码的其余部分,我们可以更具体地指出问题。

崩溃日志中提到了原因。“试图将nil对象插入数组”。如果你找不到相关的代码。我在使用NSArray的地方检查了我的代码,但没有找到insert
nil
to Array它可能是NSArray的一个子类,请检查代码中你在其他东西中插入对象的位置,并发布在崩溃之前执行的代码。你的应用程序中的
SogouInputIPhone.dylib
?这是导致崩溃的原因,而不是你的主应用程序。如果它是你的,你需要对这些帧进行符号化,然后你就会知道错误在哪里。不,SogoInputPhone.dylib是一种中文输入法。我也对此表示怀疑,但不确定。