我对使用“CFStringRef”有疑问。我见过管理iPhone接触的几个例子,在大多数人,他们使用:使用铸造而不是CFStringRef获取联系信息
...
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
CFStringRef emailRef = ABMultiValueCopyValueAtIndex(emails, 0);
...
NSString *email = (NSString *)emailRef;
我不知道为什么CFStringRef被替代使用的铸造:
...
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
NSString *email = (NSString *)ABMultiValueCopyValueAtIndex(emails, 0);
...
它是传统的以使用CFStringRef?使用直接投射是否正确?
感谢您的回答。关于释放内存,据我所知它需要释放它(使用'CFRelease(emailRef)'),正如我在本指南中所见(https://developer.apple.com/library/mac/#documentation /CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html) – rai212