You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/09/23 16:49:38 UTC

[GitHub] [cordova-plugin-file] iAMkVIN-S opened a new issue #495: Bug: Wrong type for parameter "uri" of resolveLocalFileSystemURI: Expected String, but got Null.

iAMkVIN-S opened a new issue #495:
URL: https://github.com/apache/cordova-plugin-file/issues/495


   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   The Directory for the file system should not be _null_.
   ![image](https://user-images.githubusercontent.com/40800721/134548776-057e4527-46e9-4154-8d9d-be5f9c967d88.png)
   
   
   ### What does actually happen?
   The Directory for the file system is _null_.
   ![image](https://user-images.githubusercontent.com/40800721/134548589-638a357d-a623-4d55-a48f-2c04cabbfe0b.png)
   
   
   ## Information
   It seems like the Directory returned by **resolveLocalFileSystemURI** works the first time the App is installed onto the device. On the second launch or update of the same Bundle ID on the device, the Directory is always returned as _null_
   
   In this instance, we're adding an Ionic App onto an iPhone XR via Xcode.
   The first time it is installed and ran, the Directory is good. Any subsequent time, the Directory is _null_.
   To return to a working state, the app must be fully deleted from the device.
   
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   
   
   ### Environment, Platform, Device / Version information
   Ionic:
      Ionic CLI       : 6.12.4 (/usr/local/lib/node_modules/@ionic/cli)
      Ionic Framework : @ionic/react 5.6.7
   
   Capacitor:
      Capacitor CLI   : 2.4.7
      @capacitor/core : 2.4.4
   
   Utility:
      cordova-res : 0.15.3
      native-run  : not installed
   
   System:
      NodeJS : v14.4.0 (/usr/local/bin/node)
      npm    : 6.14.5
      OS     : macOS Big Sur
   
   Device: 
      iPhone XR
      iOS : 14.8
   
   Xcode:
      version : 12.5.1
   
   
   
   
   ## Checklist
   
   - [ X ] I searched for existing GitHub issues
   - [ X ] I updated all Cordova (Capacitor) tooling to most recent version
   - [ X ] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] iAMkVIN-S commented on issue #495: Bug: Wrong type for parameter "uri" of resolveLocalFileSystemURI: Expected String, but got Null.

Posted by GitBox <gi...@apache.org>.
iAMkVIN-S commented on issue #495:
URL: https://github.com/apache/cordova-plugin-file/issues/495#issuecomment-926228652


   Hey @breautek sorry for the delay as we wanted to make sure we tested more based on your previous comment before wasting anymore of your time.
   
   We have wrapped the assigning of `_DIR` with the deviceReady event as such:
   ![image](https://user-images.githubusercontent.com/40800721/134595896-f38c328e-fdde-46ef-b5dd-65970c2eecea.png)
   
   It was our mistake, we were previously wrapping the Initialization of the plugin itself `const fm = FileManager.getInstance();` rather than the assigning. 
   
   Appreciate the help!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #495: Bug: Wrong type for parameter "uri" of resolveLocalFileSystemURI: Expected String, but got Null.

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #495:
URL: https://github.com/apache/cordova-plugin-file/issues/495#issuecomment-926058047


   That snippet looks like the right idea to me. The constants like `dataDirectory` is there for a reason ;)
   
   Can you assert that the `deviceready` event is triggering before you attempt to resolve the file path? These File path variables like `dataDirectory` will be `null` before `deviceready` is triggered.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #495: Bug: Wrong type for parameter "uri" of resolveLocalFileSystemURI: Expected String, but got Null.

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #495:
URL: https://github.com/apache/cordova-plugin-file/issues/495#issuecomment-926025194


   How are you obtaining the path for `resolveLocalFileSystemURI`?
   
   > The first time it is installed and ran, the Directory is good. Any subsequent time, the Directory is null.
   To return to a working state, the app must be fully deleted from the device.
   
   This makes it seem like you might be storing a full absolute path an iOS device and attempting to use it everywhere, instead of resolving paths relatively. This path shouldn't changed during the lifetime installation of the app. It may even remain in tact if the user installs the app via an iTunes backup. Reinstalling the app usually causes the UUID to change.
   
   The bottom line is, if you're storing a full absolute path of a file, you're gunna run into issues with iOS because that path is only valid in a certain context.
   
   > Our team cannot replicate on Android. iOS only right now.
   
   Android does not have UUID's in the filepaths, which also enforces my suspicion that you're attempting to use full paths in an invalid way.
   
   > On the second launch or update of the same Bundle ID on the device
   
   This is the only thing that doesn't quite make much sense, the UUID should remain consistent even after app updates, as long as it's on the same device. The UUID may change if you uninstall and reinstall the app.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] iAMkVIN-S commented on issue #495: Bug: Wrong type for parameter "uri" of resolveLocalFileSystemURI: Expected String, but got Null.

Posted by GitBox <gi...@apache.org>.
iAMkVIN-S commented on issue #495:
URL: https://github.com/apache/cordova-plugin-file/issues/495#issuecomment-926048649


   Hey @breautek, thank you so much for the prompt reply.
   
   > How are you obtaining the path for resolveLocalFileSystemURI?
   
   We've simplified the code snippet below to give you a rough idea of what we are doing for the path:
   ~~~
   const dir = `videos/${item.id}/`;
   const path = dir + "video.mp4";
   const _DIR = File.dataDirectory;
   _DIR + path
   ~~~
   
   Our `_DIR + path` is seemingly resolving differently:
   
   _First Install:_ 
   ![image](https://user-images.githubusercontent.com/40800721/134561361-4be217b5-35e0-4b68-8670-88b2cb58ce60.png)
   
   _After:_
   ![image](https://user-images.githubusercontent.com/40800721/134561437-7a96a6f6-2d10-4c29-b0b8-c01458efcab1.png)
   
   How would you recommend we use the path for it to be more relative? Maybe we are misunderstanding the functionality of the plugin, due to the poor documentation when looking at it from the [Ionic angle](https://ionicframework.com/docs/native/file). It seemed like `File.dataDirectory` was what to use for **"Persistent and private data storage within the application's sandbox using internal memory"**
   
   Cheers
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] iAMkVIN-S closed issue #495: Bug: Wrong type for parameter "uri" of resolveLocalFileSystemURI: Expected String, but got Null.

Posted by GitBox <gi...@apache.org>.
iAMkVIN-S closed issue #495:
URL: https://github.com/apache/cordova-plugin-file/issues/495


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org