以编程方式获取设备的电话号码

问题描述:

我需要以编程方式获取我的iOS设备的电话号码。

I need to get my iOS device's phone number programatically.

通过谷歌我发现此代码:

Via google I found this code:

NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"];
NSLog(@"Phone Number: %@", num);

但在某处我读到如果我使用此代码,Apple会拒绝我的应用。

But somewhere I read that if I use this code, Apple will reject my app.

有没有办法在没有用户输入的情况下获取当前的设备电话号码?

Is there any way to get current device phone number without user entry?

不,该设备的电话号码不能以编程方式提供,并且仍然得到Apple的批准,谢天谢地。我绝对不想要一些我出于好奇心下载的免费应用程序来获取我的电话号码并开始向我发送垃圾短信或让营销人员给我打电话。

No, the device's phone number is not available programmatically and still be approved by Apple, thankfully. I definitely don't want some free app I download out of curiosity to grab my phone number and start sending me spam SMS messages or have marketers calling me.