Reputation: 33
compiling my old ionic project with Xcode 9.2 I have problems with cordova-plugin-camera. This code:
$cordovaCamera.getPicture(options).then(function (imageData) {
var image = document.getElementById('myImage');
image.src = imageData;
});
Was perfect with Xcode 8, but now I can't see the preview of the image in img tag ...
Of course I set the content-security-policy:
<meta http-equiv="Content-Security-Policy" content="default-src * gap:;font-src 'self' data:; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'; media-src *; img-src * filesystem: data:">
What else can I do???
Massimo
Upvotes: 0
Views: 162
Reputation: 551
Probably too late, but my solution to this problem was to:
Add this inside <platform name="ios">
to my config.xml:
<edit-config target="NSCameraUsageDescription" file="platforms/ios/ios.json" mode="merge"><string>need camera access to take pictures</string></edit-config>
Add "Privacy - Camera Usage Description" to the Information Property List in appname-info.plist in xcode.
Also:
navigator.camera.getPicture(this.cameraCallback);
And then I have a callback:
cameraCallback(imageData) {
myImg.src = 'data:image/jpeg;base64,' + imageData;
}
Upvotes: 0
Reputation: 53301
Try changing the img-src to
img-src 'self' * filesystem: data: content:
Upvotes: 0