以编程方式在iPhone OS 4.0中获取自己的电话号码 [英] Programmatically get own Phone Number in iPhone OS 4.0

查看:105
本文介绍了以编程方式在iPhone OS 4.0中获取自己的电话号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为监狱破坏的手机开发一个iPhone应用程序,在这个应用程序中,我想获取用户的电话号码。

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

我已经浏览了整个stackoverflow.com并找到了一些相关的答案,但所有这些都已过时,不再适用于iOS 4.0。

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"];

但是我提到这个解决方案不再适用于iOS 4.0

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

由于我的应用程序是针对监狱破坏的手机而不是苹果应用程序商店所以我并不担心我的应用程序拒绝,因此任何私有API也适用于我。

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.

如果我们可以使用iPhone的任何私人API从SIM获取IMSI号码,请告诉我

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

推荐答案

如果您的目标是越狱手机,您可以查看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.

这篇关于以编程方式在iPhone OS 4.0中获取自己的电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆