Javascript 导航前获得联系人权限(Cordova) 我的问题

Javascript 导航前获得联系人权限(Cordova) 我的问题,javascript,ios,cordova,contacts,Javascript,Ios,Cordova,Contacts,我目前正在使用Cordova为IOS编写一个应用程序。我的应用程序中的一个屏幕需要访问联系人并允许用户将其联系人导入本地数据库的权限 我遇到的问题是,我不想在未获得访问联系人的权限之前将用户导航到“导入联系人”屏幕。这是因为,;如果应用程序没有访问用户联系人的权限,则导航到“导入联系人”屏幕没有意义 势解 因此,我提出了以下解决方案,以便在实际导航到下一屏幕“导入联系人”之前获得访问用户联系人的权限: // Attempt to gather the users local contacts v

我目前正在使用Cordova为IOS编写一个应用程序。我的应用程序中的一个屏幕需要访问联系人并允许用户将其联系人导入本地数据库的权限

我遇到的问题是,我不想在未获得访问联系人的权限之前将用户导航到“导入联系人”屏幕。这是因为,;如果应用程序没有访问用户联系人的权限,则导航到“导入联系人”屏幕没有意义

势解 因此,我提出了以下解决方案,以便在实际导航到下一屏幕“导入联系人”之前获得访问用户联系人的权限:

// Attempt to gather the users local contacts
var options             = new ContactFindOptions();
options.multiple        = true;
options.desiredFields   = [navigator.contacts.fieldType.id,navigator.contacts.fieldType.displayName];
options.hasPhoneNumber  = true;
var fields              = [navigator.contacts.fieldType.displayName, navigator.contacts.fieldType.name];
navigator.contacts.find(fields, function(){
    // Navigate to the 'import contacts' screen
}, function(){
    // Display an error based on the returned error code
    // Once dismissed, take the user to the home page
}, options);
由于我对科尔多瓦非常陌生,我不知道上述解决方案是否有任何警告。上述解决方案是解决这一问题的最佳方法还是有更好的解决方案

请注意,我目前只关心IOS,因此如果其他操作系统存在问题,请不要提及