2017-10-27 1 views
0

ios 11에서 실행되는 ipad에 배포 된 ionic v1 앱을 사용하고 있습니다. ipad에서 앱을 실행하고 카메라 버튼을 클릭하면 아무 일도 일어나지 않습니다. 그것은 그대로 유지됩니다. 필자는 ios 10과 비슷한 문제를 찾아보고 info.plst 파일에 관련 태그를 추가하고 교차 프레임 보안 우회 경로도 추가했습니다. 나는 주변을 둘러 보았지만 이것에 대한 어떤 해결책도 없었다. 나는 $ cordovaCamera가 ios 10에서 작동하지 않는 모든 가능한 해결책을 시도한 후에 만이 질문을 제기했다. 심지어 $ cordovaCamera.getPicture() 대신 navigator.camera.getPicture()를 사용하려했으나 . 내보기에서

나는 내가 또한 $ 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); 
        }); 

      }; 

이 컨트롤러에서

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

있습니다.

은 index.html을에서 나는 플랫폼 IOS 내부

<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 이러한 태그를 추가하고 안드로이드 버전은 다음 단계에 따라 시작 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; *"> 

을 추가했습니다.

1 단계) 실행이 명령

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" 

2 단계)이

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

관련 문제