在 iPhone OS 4.0 中以编程方式获取自己的电话号码
我正在为越狱手机开发一个iPhone应用程序,在这个应用程序中我想获取用户的电话号码。
我浏览了整个 stackoverflow.com 并找到了一些相关答案,但所有这些答案都已过时,并且不再适用于 iOS 4.0。
这个问题最著名的解决方案是,
NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"];
但正如我提到的,这个解决方案不再适用于 iOS 4.0,
因为我的应用程序是针对越狱手机的,而不是针对苹果应用程序商店的,所以我不担心我的应用程序被拒绝,因此任何私人API 也适合我。
另请告知我们是否可以使用 iPhone 的任何私有 API 从 SIM 卡获取 IMSI 号码
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的目标是越狱手机,您可以看看 CoreTelephony 框架。我不经常使用私有 API,因此不能保证这个特定的框架可以为您提供电话号码,但您可能会很幸运。
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.
官方不支持也不建议通过编程方式获取用户的个人信息。
此外,SDK 尚未提供任何处理 SIM 中信息的机制。
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.