2017-09-11 9 views
1

IonicとCordovaを使用してアプリを作成しています。 私はここに、 https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-previewCordova PluginカメラプレビューNSCameraUsageDescriptionが機能しません(Ionic 3)

をコルドバプラグインカメラのプレビューを追加し、それは、iOS 10+のために開発すると言う、私は

<config-file platform="ios" target="*-Info.plist" parent="NSCameraUsageDescription" overwrite="true"> 
    <string>Allow the app to use your camera</string> 
</config-file> 

私のconfig.xmlにいくつかのコードを追加する必要がありますので、私はこれらを追加しましたが、私の* -Info.plistは変更されません。私はまだ持っています

このアプリは使用法の説明なしでプライバシーに敏感なデータにアクセスしようとしたためクラッシュしました。アプリのInfo.plistには、アプリがこのデータをどのように使用するかをユーザーに説明する文字列値を持つNSCameraUsageDescriptionキーが含まれている必要があります。

ので、私は

ionic cordova plugin rm cordova-plugin-camera-preview 

を入力してから

ionic cordova plugin add https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git --variable CAMERA_USAGE_DESCRIPTION="Allow the app to use your camera" 

を追加し、ionic cordova build ios --prodそれでも、* -Info.plistは変更されませんでした。

私のconfig.xmlファイル:

<platform name="ios"> 
    <config-file overwrite="true" parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist"> 
     <string>Allow the app to use your camera</string> 
    </config-file> 
    <allow-intent href="itms:*" /> 
    <allow-intent href="itms-apps:*" /> 
    <icon height="57" src="resources/ios/icon/icon.png" width="57" /> 
    <icon height="114" src="resources/ios/icon/[email protected]" width="114" /> 
    <icon height="40" src="resources/ios/icon/icon-40.png" width="40" /> 
    <icon height="80" src="resources/ios/icon/[email protected]" width="80" /> 
    <icon height="120" src="resources/ios/icon/[email protected]" width="120" /> 
    <icon height="50" src="resources/ios/icon/icon-50.png" width="50" /> 
    <icon height="100" src="resources/ios/icon/[email protected]" width="100" /> 
    <icon height="60" src="resources/ios/icon/icon-60.png" width="60" /> 
    <icon height="120" src="resources/ios/icon/[email protected]" width="120" /> 
    <icon height="180" src="resources/ios/icon/[email protected]" width="180" /> 
    <icon height="72" src="resources/ios/icon/icon-72.png" width="72" /> 
    <icon height="144" src="resources/ios/icon/[email protected]" width="144" /> 
    <icon height="76" src="resources/ios/icon/icon-76.png" width="76" /> 
    <icon height="152" src="resources/ios/icon/[email protected]" width="152" /> 
    <icon height="167" src="resources/ios/icon/[email protected]" width="167" /> 
    <icon height="29" src="resources/ios/icon/icon-small.png" width="29" /> 
    <icon height="58" src="resources/ios/icon/[email protected]" width="58" /> 
    <icon height="87" src="resources/ios/icon/[email protected]" width="87" /> 
    <splash height="1136" src="resources/ios/splash/[email protected]~iphone.png" width="640" /> 
    <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" /> 
    <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" /> 
    <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" /> 
    <splash height="1536" src="resources/ios/splash/[email protected]~ipad.png" width="2048" /> 
    <splash height="2048" src="resources/ios/splash/[email protected]~ipadpro.png" width="2732" /> 
    <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" /> 
    <splash height="2048" src="resources/ios/splash/[email protected]~ipad.png" width="1536" /> 
    <splash height="2732" src="resources/ios/splash/[email protected]~ipadpro.png" width="2048" /> 
    <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" /> 
    <splash height="960" src="resources/ios/splash/[email protected]~iphone.png" width="640" /> 
    <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> 
</platform> 
<engine name="android" spec="^6.2.3" /> 
<engine name="browser" spec="^4.1.0" /> 
<engine name="ios" spec="^4.4.0" /> 
<plugin name="cordova-plugin-camera-preview" spec="git+https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git"> 
    <variable name="CAMERA_USAGE_DESCRIPTION" value="Allow the app to use your camera" /> 
</plugin> 
<plugin name="cordova-plugin-console" spec="^1.0.7" /> 
<plugin name="cordova-plugin-device" spec="^1.1.6" /> 
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" /> 
<plugin name="cordova-plugin-statusbar" spec="^2.2.3" /> 
<plugin name="cordova-plugin-whitelist" spec="^1.3.2" /> 
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" /> 

私のpackage.json:

{ 
"name": "righthere", 
"version": "0.0.1", 
"author": "Ionic Framework", 
"homepage": "http://ionicframework.com/", 
"private": true, 
"scripts": { 
    "clean": "ionic-app-scripts clean", 
    "build": "ionic-app-scripts build", 
    "lint": "ionic-app-scripts lint", 
    "ionic:build": "ionic-app-scripts build", 
    "ionic:serve": "ionic-app-scripts serve" 
}, 
"dependencies": { 
    "@angular/common": "4.1.3", 
    "@angular/compiler": "4.1.3", 
    "@angular/compiler-cli": "4.1.3", 
    "@angular/core": "4.1.3", 
    "@angular/forms": "4.1.3", 
    "@angular/http": "4.1.3", 
    "@angular/platform-browser": "4.1.3", 
    "@angular/platform-browser-dynamic": "4.1.3", 
    "@ionic-native/camera-preview": "^4.2.1", 
    "@ionic-native/core": "3.12.1", 
    "@ionic-native/splash-screen": "3.12.1", 
    "@ionic-native/status-bar": "3.12.1", 
    "@ionic/storage": "2.0.1", 
    "cordova-android": "^6.2.3", 
    "cordova-browser": "^4.1.0", 
    "cordova-ios": "^4.4.0", 
    "cordova-plugin-camera-preview": "git+https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git", 
    "cordova-plugin-console": "^1.0.7", 
    "cordova-plugin-device": "^1.1.6", 
    "cordova-plugin-splashscreen": "^4.0.3", 
    "cordova-plugin-statusbar": "^2.2.3", 
    "cordova-plugin-whitelist": "^1.3.2", 
    "ionic-angular": "3.5.3", 
    "ionic-plugin-keyboard": "^2.2.1", 
    "ionicons": "3.0.0", 
    "rxjs": "5.4.0", 
    "sw-toolbox": "3.6.0", 
    "zone.js": "0.8.12" 
}, 
"devDependencies": { 
    "@ionic/app-scripts": "^2.1.4", 
    "@ionic/cli-plugin-cordova": "1.4.1", 
    "@ionic/cli-plugin-ionic-angular": "1.3.2", 
    "ionic": "3.6.0", 
    "object-keys": "^1.0.11", 
    "typescript": "2.3.4" 
}, 
"description": "An Ionic project", 
"cordova": { 
    "plugins": { 
     "cordova-plugin-console": {}, 
     "cordova-plugin-device": {}, 
     "cordova-plugin-splashscreen": {}, 
     "cordova-plugin-statusbar": {}, 
     "cordova-plugin-whitelist": {}, 
     "ionic-plugin-keyboard": {}, 
     "cordova-plugin-camera-preview": { 
      "CAMERA_USAGE_DESCRIPTION": "Allow the app to use your camera" 
     } 
    }, 
    "platforms": [ 
     "android", 
     "browser", 
     "ios" 
    ] 
} 

}

私の情報: CLIパッケージ:

@ionic/cli-utils : 1.6.0 (/Users/hbin/righthere/node_modules/ionic/node_modules/@ionic/cli-utils) 
ionic (Ionic CLI) : 3.6.0 (/Users/hbin/righthere/node_modules/ionic) 

グローバルパック年齢:

Cordova CLI : 7.0.1 

ローカルパッケージ:

@ionic/app-scripts    : 2.1.4 
@ionic/cli-plugin-cordova  : 1.4.1 
@ionic/cli-plugin-ionic-angular : 1.3.2 
Cordova Platforms    : android 6.2.3 ios 4.4.0 
Ionic Framework     : ionic-angular 3.5.3 

システム:

Node  : v8.1.3 
OS   : macOS Sierra 
Xcode  : Xcode 8.3.3 Build version 8E3004b 
ios-deploy : 1.9.2 
npm  : 5.4.1 

私は*の-Info.plistにNSCameraUsageDescriptionを追加する方法を見つけ出すことはできません。

どうすればよいですか?

答えて

0

enter image description hereプライバシー - カメラの使用説明

+0

Info.plistのおかげで上記のキーを追加します!今私は問題を解決しました! –

+0

XCodeプロジェクトをIonic CLIから更新するときにオーバーライドされるため、これは本当の解決策ではありません... – andreas

関連する問題