0
在我的地址簿的應用程序,當我取電子郵件ID的接觸,我等這樣的事情:轉換kABemailProperty到的NSString
ABMultiValueRef 0x2994e0 with 1 value(s)
0: null (0x3f5655e0) - [email protected] (0x2994b0)
如何從獲得即字符串值僅
[email protected]
以上結果?
感謝
在我的地址簿的應用程序,當我取電子郵件ID的接觸,我等這樣的事情:轉換kABemailProperty到的NSString
ABMultiValueRef 0x2994e0 with 1 value(s)
0: null (0x3f5655e0) - [email protected] (0x2994b0)
如何從獲得即字符串值僅
[email protected]
以上結果?
感謝
// This is what you have currently (i.e. the multivalues)
ABMultiValueRef emailValues = ABRecordCopyValue(person, kABPersonEmailProperty);
// This is how you extract the first item from the multivalues:
CFStringRef cfEmailAddress = ABMultiValueCopyValueAtIndex(emailValues, 0);
// This is how you convert it to an NSString.
NSString *emailAddress = CFBridgingRelease(cfEmailAddress);
發佈您的代碼。 ABMultiValueRef ...看起來像一個數組,你可能會轉換爲NSString – 0x8badf00d