开发者

User information in address book on iOS

On MacOS X I can use the method me in the ABAddressBook class to get the logged in user's record, see Apple's documentation. On iOS there is no similar function call (in the corresponding C interface) listed in the documentation. The iOS address b开发者_开发百科ook does not seem to preserve this information upon synchronization.

Is there any way to identify the user under iOS or do I need to devise a proprietary mechanism for every single one of my apps?


I'm afraid iOS does not offer a method to return the owner's contact card. I was hopeful you could get the device's phone number and then search for the same number in the address book.

The device's phone number can be found with this bit of code
NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"];

Unfortunately getting the device's phone number is a violation of the developer agreement. Apple would reject any app that used it.

Sorry for the "no" answer. At least we both now know what doesn't work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜