【问题标题】:Meteor-Cordova :How To add permissions?Meteor-Cordova:如何添加权限?
【发布时间】:2017-05-11 09:43:22
【问题描述】:

我创建了meteor移动应用,还添加了

 meteor-config.js

添加了splashscreens、icons等。但是如何在我的 Meteor 应用程序中添加此类权限GeoLocation,sms,Read Contacts,take picture 和 @ 987654329@等

【问题讨论】:

    标签: javascript cordova meteor phonegap-plugins


    【解决方案1】:

    在 mobile-config.js 中包含相机插件详细信息,如下所示。

    App.configurePlugin('cordova-plugin-camera', {
       'CAMERA_USAGE_DESCRIPTION': 'To take photos'
    });
    

    如果插件需要任何变量,则将其作为键值对提供。

    同样包含其他插件。

    参考https://guide.meteor.com/mobile.html#installing-plugins

    http://docs.meteor.com/api/mobile-config.html

    【讨论】:

    • 您正在使用 meteor add cordova:cordova-plugin-camera@1.2.0 添加插件,类似地使用 App.configurePlugin 中的插件 ID“cordova-plugin-camera”,正如我上面指定的那样。其他插件也一样。
    【解决方案2】:

    @vbharath 建议的答案对我不起作用(Meteor 1.8)。 对于相机插件,我使用plugin docs 中的解决方案App.appendConfig (details here):

    App.appendToConfig(`
    <edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
        <string>Need camera access to take pictures</string>
    </edit-config>
    
    <edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
        <string>Need photo library acess to upload images from galery</string>
    </edit-config>
    `)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-08
      • 1970-01-01
      • 1970-01-01
      • 2019-12-13
      • 1970-01-01
      相关资源
      最近更新 更多