开发者

Address Book propertyID - unknown type?

开发者 https://www.devze.com 2023-02-08 03:31 出处:网络
Working on an app that makes heavy use of the Address Book framework. There are a number of View Controllers that interact with Address Book data, and they all work just fine. Except for one, and it\'

Working on an app that makes heavy use of the Address Book framework. There are a number of View Controllers that interact with Address Book data, and they all work just fine. Except for one, and it's killing me.

I have a class that wraps address book access, in a method such as:

- (NSDictionary*)labelsToValues:(ABPropertyID)propertyID {
ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef aRecord = ABAddressBookGetPersonWithRecordID(addressBook, [self recordIdFromAddressBookId]);

NSMutableDictionary *entries = [NSMutableDictionary dictionary];    

ABMultiValueRef multiValueProperty = ABRecordCopyValue(aRecord, propertyID);
// do some other stuff

And then I call it in places like开发者_开发技巧 this:

- (NSDictionary*)emailProperties {
return [self labelsToValues:kABPersonEmailProperty];
}

And it works! Of course it does, I'm sending the message with an argument that is a Constant from the Address Book framework. So it should always work!

But that's not the case. This particular emailProperties: message is one that I'm calling in several places... and sometimes it works, but sometimes it doesn't. When things go awry, I put it through the debugger and I get something like this:

Address Book propertyID - unknown type?

How is that possible!? Even odder, if I sort of "prime" the problematic View Controller by viewing other View Controllers where everything behaves as expected, and then I return to the problematic View Controller, everything works fine. So, I'm guessing this is some sort of linking error, but I'm not sure how to even begin with troubleshooting that.


Turns out my question was a dupe of Address Book constants evaluating as zero, please vote to close.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号