Programmatically get own Phone Number in iPhone OS 4.0

吃可爱长大的小学妹 提交于 2019-12-01 09:09:54

问题


I am developing an iPhone application for jail broken phones and in this application I would like to fetch user's phone number.

I have gone through the entire stackoverflow.com and found some relevant answers but all of them are obsolete and doesn't work with iOS 4.0 anymore.

The most famous solution for this problem is

NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"];

but as I mentioned this solution no more works with iOS 4.0

As my application is intended towards the jail broken phones and not intended the Apple app store so I am not worried about my app rejection, hence any private API will also work for me.

Also please let me know if we can fetch IMSI number from SIM using any private APIs of iPhone


回答1:


If you're targeting jailbroken phones, you might take a look at the CoreTelephony framework. I don't often work with private APIs, so no guarantees this particular framework makes the phone number available to you, but you might get lucky.




回答2:


Officially, it's not supported, nor is it recommended to get the user's personal information programmatically.

Also, the SDK does not yet provide any mechanism to work with information in the SIM.



来源:https://stackoverflow.com/questions/4544803/programmatically-get-own-phone-number-in-iphone-os-4-0

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