2017-10-27 16 views
0

ios 11で動作するipadにデプロイされたionic v1アプリケーションを使用しています。ipadでアプリケーションを実行してカメラボタンをクリックしようとすると、何も起こりません。それはそのままです。私はios 10と同様の問題点を探して、info.plstファイルの関連タグを追加し、クロスフレームセキュリティバイパスを追加しました。私は周りを見回しましたが、これに対する解決策はありませんでした。私は$ cordovaCamera.getPicture()の代わりにnavigator.camera.getPicture()を使用しようとしましたが、そのコードではどちらも問題ありませんでした。 。私の見解では

私はコントローラで

<a ng-click="takePicture()" style="color:#fff;"> 

を持っている私は$ cordovaCameraをも注入されているコントローラで

$scope.takePicture = function (options) { 

        var options = { 
          destinationType: Camera.DestinationType.DATA_URL, 
          sourceType: Camera.PictureSourceType.CAMERA, 
          allowEdit: true, 
          quality: 100, 
          targetWidth: 300, 
          targetHeight: 300, 
          encodingType: Camera.EncodingType.JPEG, 
          popoverOptions: CameraPopoverOptions, 
          saveToPhotoAlbum: false, 
          correctOrientation:true 
        }; 

       $cordovaCamera.getPicture(options).then(function(imageData) { 
             console.log('here'); 

        $scope.pictureUrl = "data:image/jpeg;base64," + imageData; 

        console.log(imageData); 
        $scope.img_update = 1; 
        }, function(err) { 
        console.log(err); 
        }); 

      }; 

を持っています。

私は、プラットフォームのIOS内でこれらのタグを追加している私はconfig.xmlに

<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; script-src &apos;self&apos; &apos;unsafe-inline&apos; &apos;unsafe-eval&apos; *; style-src &apos;self&apos; &apos;unsafe-inline&apos; *"> 

を追加したのindex.htmlで

<plugin name="cordova-plugin-camera" spec="~2.3.0"> 
     <variable name="CAMERA_USAGE_DESCRIPTION" value="The app would like to access the camera when you attach photos to content." /> 
     <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="The app would like to access the photo library when you attach images to content." /> 
    </plugin> 
    <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 to photo library access to get pictures from there</string> 
    </edit-config> 
    <edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge"> 
     <string>need location access to find things nearby</string> 
    </edit-config> 
    <edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge"> 
     <string>need to photo library access to save pictures there</string> 
    </edit-config> 

答えて

0

更新し、最新のIOSとAndroidのバージョン、その後の手順に従って開始します。

ステップ1)ステップ2

ionic cordova plugin rm camera 
ionic cordova plugin add cordova-plugin-camera --variable CAMERA_USAGE_DESCRIPTION="your usage message" --variable PHOTOLIBRARY_USAGE_DESCRIPTION="your usage message" 

このコマンドを実行します)この

var options = { 
// Size 
quality: 80, 
targetWidth: 1024, 
targetHeight: 768, 
// Actions 
allowEdit: false, 
correctOrientation: false, 
saveToPhotoAlbum: false, 
// iOS 
popoverOptions: CameraPopoverOptions, 
// Basic 
encodingType: Camera.EncodingType.JPEG, 
sourceType: Camera.PictureSourceType.CAMERA, 
destinationType: this.platform.is('ios') ? Camera.DestinationType.FILE_URI : Camera.DestinationType.DATA_URL,  
}; 

そして、あなたは完了などのオプションを追加します。

+0

@ArkoD上記の解決策をお試しください。 – Dixit

+0

私は今日それを試してみましょう、あなたに知らせてください。ありがとう。 – ArkoD

+0

@ArkoD OK。ありがとう – Dixit

関連する問題