是否可以使用 ionic 1.x(或 beta@2)和 cordova 获得 iPhone phone 数字?

Is it possible to get iPhone phone number using ionic 1.x(or beta@2) and cordova?

我正在构建一个简单的应用程序,它只具有身份验证功能,用户登录该应用程序后,他们可以在主页上查看他们的 phone 号码(仅 iphone)。

可能吗?如果是,怎么做?

谢谢...

Android

var deviceInformation = cordova.require("cordova/plugin/DeviceInformation");
deviceInformation .get(function(result) {
     console.log("result = " + result);
}, function() {
     console.log("error");
});

Plugin here & Reference here

更新


没有 iOS

它违反了截至 2009 年 11 月 5 日的最新 SDK 协议。以下是 Apple 的回应:

"For security reasons, iPhone OS restricts an application (including its preferences and data) to a unique location in the file system. This restriction is part of the security feature known as the application's "sandbox." The sandbox is a set of fine-grained controls limiting an application's access to files, preferences, network resources, hardware, and so on."

The device's phone number is not available within your application's container. You will need to revise your application to read only within your directory container and resubmit your binary to iTunes Connect in order for your application to be reconsidered for the App Store.

这真是令人失望,因为我们想让用户不必输入自己的 phone 号码。

原答案here

此致。