科尔多瓦相机插件IOS 11无法从库中挑选图像

时间:2017-11-28 11:56:26

标签: javascript ios cordova ionic-framework

我使用ionicXcodecordova-plugin-camera访问我的iphone库。它在IOS 11.1.2上运行。

我猜所有授权都已设置好,但是当我点击图片选取器库中的图片时(图片选择器正在显示),我收到此错误:

发现扩展时遇到

[发现]错误:错误域= PlugInKit代码= 13"查询已取消" UserInfo = {NSLocalizedDescription =查询已取消}

关注此主题: PhotoPicker discovery error: Error Domain=PlugInKit Code=13看来这可能是缺少权限错误。

正如您在下面看到的那样Info.plist已经设定,我无法找到我的错误,任何想法?

enter image description here enter image description here enter image description here enter image description here



// FUNCTION TO OPEN MY IPHONE'S LIBRARY AND SELECT A PIC

$scope.takePic = function()
{
    navigator.camera.getPicture(
    function(uri){
        //console.log(uri);
    },

    function(){
	   $ionicPopup.alert({
	         title: 'Error',
	         template: 'Impossible'
	         });
    },
    {
    	destinationType: 1,
    	sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
    	allowEdit: false,
    	saveToPhotoAlbum: false,
    	quality: 30,
     }
     );

};

<!--LINES ADDING IN MY CONFIG.XML TO SET THE INFO.PLIST FILE -->

<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>

<!-- BUTTON THAT IS CALLING THE FUNCTION -->

<button ng-click="takePic()" style="font-weight:300;border-radius:10px 10px 10px 10px;" class="button button-positive button-block">Take picture</button>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

有完全相同的问题。阅读文档,它指定:

NSPhotoLibraryUsageDescription 虽然此键控制对用户照片库的读写访问权限,但如果您的应用只需要向库中添加资源而不需要读取任何资源,则最好使用NSPhotoLibraryAddUsageDescription。

从技术上讲,仅使用NSPhotoLibraryUsageDescription就足够了。试图删除NSPhotoLibraryAddUsageDescription,但没有什么区别,我仍然得到相同的错误信息,无论是否有。