MonoTouch 如何获取自己的电话号码和 Sim Id(SSID)?
我无法使用 Monotouch 获取自己的电话号码和 Sim ID (SSID) 我尝试过:
var v = NSUserDefaults.StandardUserDefaults.ValueForKey((NSString)@"SBFormattedPhoneNumber");
var t = NSUserDefaults.StandardUserDefaults.ValueForKey((NSString)@"ICCID");
new UIAlertView("Ur phone Number",""+v.ToString(),null,"Ok",null).Show();
new UIAlertView("Ur ICCID",""+t.ToString(),null,"Ok",null).Show();
和所有其他 ValueFor***
它总是返回 null
或 " "
在 iphone 3g 上尝试过。请帮忙。
Im stuck to get own phone number and Sim ID (SSID) using Monotouch
I tryed:
var v = NSUserDefaults.StandardUserDefaults.ValueForKey((NSString)@"SBFormattedPhoneNumber");
var t = NSUserDefaults.StandardUserDefaults.ValueForKey((NSString)@"ICCID");
new UIAlertView("Ur phone Number",""+v.ToString(),null,"Ok",null).Show();
new UIAlertView("Ur ICCID",""+t.ToString(),null,"Ok",null).Show();
and all other ValueFor***
it always return null
or " "
Tried on iphone 3g. Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Apple 不想访问此信息,因为它很容易被滥用。任何这样做的应用程序都可能会被 AppStore 拒绝。请参阅此答案中的评论(超过 30 票赞成)。
另请注意,上面的代码不会从 SIM 卡中读取 - 它会从 iTunes 注册数据中读取,该数据不必设置为任何值(即您不能信任它)。
Apple does not want to to access this information as it can easily be misused. Any application doing so is likely to be rejected from the AppStore. See the comment (with more than 30 up votes) from this answer.
Also note that your code above does not read from the SIM - it reads from the iTunes registration data, which does not have to be set to any value (i.e. you can't trust it).