我SIGABRT
在 Mac OS X 10.8.3 和 Xcode 4.6.3 上遇到了:
2013-09-20 06:31:02.676 groupinfo[958:303] -[__NSArrayI stringByAppendingString:]:
unrecognized selector sent to instance 0x100408850
...
2013-09-20 07:13:29.575 groupinfo[987:303] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException'
发生在下面的SIGABRT
第 41 行,但我没有NSArray
在该区域使用 a:
32 NSArray *results = [query resultsAllowingPartial:NO error:nil];
33 for (ODRecord *record in results) {
34
35 NSArray* group = [NSArray arrayWithObject:kODAttributeTypePrimaryGroupID];
36 NSDictionary* dict = [record recordDetailsForAttributes:group error:nil];
37
38 NSString* str = @"";
39 if(dict) {
40 str = [str stringByAppendingString:[dict valueForKey:kODAttributeTypePrimaryGroupID]];
41 str = [str stringByAppendingString:@" "];
42 }
43
44 str = [str stringByAppendingString:[record recordName]];
45 NSLog(@"%@", str);
46 }
我在第 40 行验证了字典中的值是NSString
.
任何想法为什么stringByAppendingString
被发送到数组而不是str
?还是某个地方有一个隐藏的数组,我错过了一些明显的预期行为?