Mac ABRecord setValue forProperty错误

时间:2013-10-16 09:51:09

标签: macos cocoa

当我像这样使用AddressBook时:

ABAddressBook *ab = [ABAddressBook addressBook];  
ABPerson *person = [[ABPerson alloc]init];  
[person setValue:lastName forProperty:kABLastNameProperty];  
[ab addRecord:person];  
[ab save];

我收到了错误:

`Terminating app due to uncaught exception 'NSInvalidArgumentException',reason: '-[__NSCFString count]: unrecognized selector sent to instance 0x1001448a0'`

setValue:forProperty做什么

1 个答案:

答案 0 :(得分:0)

看起来问题出现在

-[__NSCFString count]

setValue:forProperty设置属性的值。看起来问题可能是您尝试设置的lastName对象。