我正在尝试使用 AddressBook 和 AddressBookUI 来显示地址簿的视图,然后用户可以在其中点击联系人,然后点击电话号码,并且应用程序会收到电话号码。当我遍历 ABMultiValue 以查找具有所选标识符的条目时遇到问题 - 错误“ ”在循环行(第 13 行)Binary operator '<' cannot be applied to two CFIndex operands
上引发。for
我已经粘贴了下面的代码 - 有没有人知道为什么会发生这种情况/我可以做些什么来解决它?谢谢!
func peoplePickerNavigationController(peoplePicker: ABPeoplePickerNavigationController!, didSelectPerson person: ABRecord!, property: ABPropertyID, identifier: ABMultiValueIdentifier) {
self.peoplePickerNavigationController(peoplePicker, shouldContinueAfterSelectingPerson: person, property: property, identifier: identifier)
// Get name
// If wanting a composite name including prefix, suxif, title, both names etc:
// NSString *contactName = CFBridgingRelease(ABRecordCopyCompositeName(person));
let contactName = ABRecordCopyValue(person, kABPersonFirstNameProperty)
// Get number
var number = String()
let numbers = ABRecordCopyValue(person, kABPersonPhoneProperty)
for var index:CFIndex = 0; index < ABMultiValueGetCount(numbers); ++index{
if identifier = ABMultiValueGetIdentifierAtIndex(numbers, index) {
number = ABMultiValueCopyValueAtIndex(numbers, index)
}
}
}