这条线怎么可能导致崩溃?

时间:2011-02-16 16:10:45

标签: iphone

麻烦代码:

NSDictionary *contactNameDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:item, @"contact", sortName, @"contactSortName", compositeName, @"compositeName", nil];

错误:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread:  0

    Thread 0 Crashed:
    0   libobjc.A.dylib                 0x00004420 objc_msgSend + 24
    1   CoreFoundation                  0x000042a6 CFRetain + 54
    2   CoreFoundation                  0x0000a9f0 __CFBasicHashStandardRetainValue + 8
    3   CoreFoundation                  0x000054c0 __CFBasicHashAddValue + 100
    4   CoreFoundation                  0x00006184 CFBasicHashAddValue + 276
    5   CoreFoundation                  0x00006cfe CFDictionaryCreate + 58
    6   CoreFoundation                  0x00033d7c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 1456
    7   CoreFoundation                  0x000361bc -[NSDictionary initWithObjectsAndKeys:] + 776
    8   iota                            0x0000cb04 -[CorpDirViewController reloadDisplayList] (CorpDirViewController.m:833)

2 个答案:

答案 0 :(得分:3)

也许一个(或多个)item,sortName或compositeName已超出范围并被垃圾收集,即使它们是非零的。

答案 1 :(得分:0)

item,sortName或compositeName是nil