attempt to insert nil object fro

2017-02-21  本文已影响0人  Helen_kay

attempt to insert nil object from objects[0]

2016-12-05 17:44:42.038 uhome[4340:2273418] UMLOG:
 error: session_id=3A821E460C3A5941D9F24BACA849BAC6, 
context=*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: 
attempt to insert nil object from objects[0]
(null)
((
    0   CoreFoundation                      0x000000018fa5a1d8 <redacted> + 148
    1   libobjc.A.dylib                     0x000000018e49455c objc_exception_throw + 56
    2   CoreFoundation                      0x000000018f93ec3c <redacted> + 364
    3   CoreFoundation                      0x000000018f93eaac <redacted> + 64
    4   uhome                               0x000000010056f994 -[SEGWashingCarRequestManager requestSubmitTagByorderSid:tagsList:Finished:] + 152
    5   uhome                               0x00000001004d45f0 -[SEGEvaluateViewController submitEvaluation:] + 1332
    6   UIKit                               0x00000001958ea484 <redacted> + 96
    7   UIKit                               0x00000001958ea404 <redacted> + 80
    8   UIKit                               0x00000001958d48b8 <redacted> + 452
    9   UIKit                               0x00000001958e9cf0 <redacted> + 584
    10  UIKit                               0x00000001958e9818 <redacted> + 2484
    11  UIKit                               0x00000001958e4a60 <redacted> + 2988
    12  UIKit                               0x00000001958b552c <redacted> + 340
    13  UIKit                               0x00000001960a2a54 <redacted> + 2736
    14  UIKit                               0x000000019609c4bc <redacted> + 784
    15  CoreFoundation                      0x000000018fa08278 <redacted> + 24
    16  CoreFoundation                      0x000000018fa07bc0 <redacted> + 524
    17  CoreFoundation                      0x000000018fa057c0 <redacted> + 804
    18  CoreFoundation                      0x000000018f934048 CFRunLoopRunSpecific + 444
    19  GraphicsServices                    0x00000001913ba198 GSEventRunModal + 180
    20  UIKit                               0x00000001959202fc <redacted> + 684
    21  UIKit                               0x000000019591b034 UIApplicationMain + 208
    22  uhome                               0x00000001001b4e6c main + 164
    23  libdyld.dylib                       0x000000018e9185b8 <redacted> + 4
)

852D0C9C-25AD-42E0-B1C8-B3BFEFB62D17.png

原因如下:

self.tagList.selectedArray.count <= 0

self.tagList.selectedArray数据源为nil

对nil进行了.count运算

解决方法:

if(self.tagList.selectedArray && self.tagList.selectedArray.count <= 0 )

  1. self.tagList.selectedArray先确定self.tagList.selectedArray不为nil

  2. 再对self.tagList.selectedArray进行.count操作

解决问题心得:

解决该问题先找出出错的数组,该数组存在的含义,在哪儿用到,数组里面存放的什么东西。

debug调试是否为nil,为nil对数组做判断

上一篇下一篇

猜你喜欢

热点阅读