崩溃异常:NSInvalidArgumentException-[__ NSPlaceholderDictionary initWithObjects:forKeys:count:]:尝试从对象中插入零对象[1]

时间:2019-12-12 07:45:08

标签: ios objective-c swift fatal-error

我的crashlytics报告中出现此崩溃,这仅在iPhone 7(iOS 13 *)中发生。我也尝试在模拟器和真实设备中调试此崩溃,但是在我的任何设备中都没有崩溃。我不知道该怎么办,以找出崩溃背后的真正原因。任何帮助,将不胜感激。预先感谢!

Fatal Exception: NSInvalidArgumentException
    0  CoreFoundation                 0x1a691980c __exceptionPreprocess
    1  libobjc.A.dylib                0x1a6641fa4 objc_exception_throw
    2  CoreFoundation                 0x1a696f350 -[__NSCFString characterAtIndex:].cold.1
    3  CoreFoundation                 0x1a69786b4 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.5
    4  CoreFoundation                 0x1a680650c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]
    5  CoreFoundation                 0x1a67f83a0 +[NSDictionary dictionaryWithObjects:forKeys:count:]
    6  Mfilterit                      0x101c11ec8 (Missing)
    7  Mfilterit                      0x101c11378 (Missing)
    8  Mfilterit                      0x101c191b8 (Missing)
    9  Mfilterit                      0x101c08d6c (Missing)
    10 Mfilterit                      0x101c0c1fc (Missing)
    11 Mfilterit                      0x101c0c188 (Missing)
    12 Mfilterit                      0x101c0c27c (Missing)
    13 Mfilterit                      0x101c08b9c (Missing)
    14 Mfilterit                      0x101c08b00 (Missing)
    15 Mfilterit                      0x101c09374 (Missing)
    16 Mfilterit                      0x101c0c1fc (Missing)
    17 libdispatch.dylib              0x1a65e6610 _dispatch_call_block_and_release
    18 libdispatch.dylib              0x1a65e7184 _dispatch_client_callout
    19 libdispatch.dylib              0x1a6593404 _dispatch_lane_serial_drain$VARIANT$mp
    20 libdispatch.dylib              0x1a6593df8 _dispatch_lane_invoke$VARIANT$mp
    21 libdispatch.dylib              0x1a659d314 _dispatch_workloop_worker_thread
    22 libsystem_pthread.dylib        0x1a6636f88 _pthread_wqthread
    23 libsystem_pthread.dylib        0x1a6639ad4 start_wqthread

1 个答案:

答案 0 :(得分:0)

如果使用以下语法初始化NSDictionary,则会发生此类崩溃:

NSDictionary* myDictionary = @{@"SomeKey":@"SomeValue",@"SomeKey":@"SomeValue"};

如果键或值之一为nil,则会发生这种情况。如果使用此语法,则必须在项目中搜索该语法,并确保所有键和值都不为空。