Setting kABPersonType
I'm trying to set the kABPersonType value for a contact (ABAddressBook iOS).
ABRecordSetValue(person, kABPersonType, [currentContact personType], nil);//person type (individual or company
[currentContact personType] is an NSNumber.
An error gets thrown when we reach ABAddressBookSave.
As follows;
*** Ter开发者_如何学Cminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber length]: unrecognized selector sent to instance 0x6805ff0'
In all other cases; e.g.
ABRecordSetValue(person, kABPersonNoteProperty, [currentContact note], nil);
The setting of properties is fine.
Any ideas why this is happening?
Cheers,
Rich
You cannot set a record's record type. The record type is determined by the type of record you create (ABPersonCreate() or ABGroupCreate()) and cannot be changed later.
If you mean to set the person record kind (to person or company) instead, you have to use the correct constants: kABPersonKindProperty as the second argument, and the value argument (NSNumber) must contain kABPersonKindPerson.
加载中,请稍侯......
精彩评论