apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
967 stars 1.55k forks source link

Plugin doesn't show image or video after restarting the app with WKWebView #681

Closed wingo7 closed 3 years ago

wingo7 commented 4 years ago

Bug Report

The plugin doesn't show image or video after restarting the app with WKWebView

Problem

After restarting the app video file or image file is not available anymore with WKWebView. After choosing an image or video from the gallery it works fine, but if I restart the app image or video is not available anymore by the path received before. This issue reminds me #506 issue, with the only the difference WKWebView instead of UIWebView.

What is expected to happen?

I expect to see an image or video after restarting the app as it was with UIWebView

What does actually happen?

I updated my Cordova ios version to 5.1.1 to use WKWebView as described here: https://cordova.apache.org/howto/2020/03/18/wkwebviewonly.html I installed the latest version of this plugin, that doesn't solve the problem

Information

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : not installed

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.9.1

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.4 
Node              : v8.11.3
npm               : 5.6.0 
OS                : macOS
Xcode             : Xcode 12.1 Build version 12A7403 

Command or Code

Environment, Platform, Device

ios 14.1, cordova-ios 5.1.1

Checklist

darshanrampatel commented 4 years ago

I am seeing the same behaviour as well.

I managed to work-around this by editing the tempFilePath function as below: https://github.com/apache/cordova-plugin-camera/blob/db2ffedecc23993e2393a6226a63bd05998f0f01/src/ios/CDVCamera.m#L397

NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath]; NSString* docsPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/NoCloud"];

Note: this may mean you are storing files on the device permanently depending on how you clean up the files, but this is fine for my use case.

PieterVanPoyer commented 3 years ago

@wingo7 is this issue still occuring?

The plugin doesn't aim to store the image or video permanently on the device.

The plugin want's to pass the selected image (or video) to the html side. You should upload it to a server f.e.. But it does not aim to keep it available permanently.

PieterVanPoyer commented 3 years ago

Closing ticket due to lack of response, issue is probably solved with most recent Cordova tooling.