Is it possible to detect a phone number of the device in iOS?

房东的猫 提交于 2019-12-23 16:43:20

问题


I have bunch of customers' phone number information with their profile in my database.

What I'm planning to do is that an iPhone searches for matching phone number and its customer's profile in my database as soon as the application runs. And it displays the customer profile on the screen.

The problem is.. I was told that iOS 4.x allowed this before... but not anymore after that version :S Can I still access to the device information and get its number? If yes, how?


回答1:


Nope. Not in a way it would be accepted by the iTunes store. You did your research and it is where it ends. The only way you can get it is by asking the user to enter the phone number during the app's first run and probably cross check it with the database you already have.




回答2:


You can use CTSettingCopyMyPhoneNumber() from CoreTelephony.framework

extern NSString* CTSettingCopyMyPhoneNumber();
NSString *phone = CTSettingCopyMyPhoneNumber();
NSLog(@"Phone : %@", phone);


来源:https://stackoverflow.com/questions/13460804/is-it-possible-to-detect-a-phone-number-of-the-device-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!