问题
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