My app has a feature that allows users to upload expense item images. The user is able to select an image from their library or take a picture themselves. When they do this, a preview of the image appears in the app. Up until the new WKWebView release and new Ionic, everything worked fine. Now, the app crashes with the message:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString replaceOccurrencesOfString:withString:options:range:]: nil argument'
Some insight into the code that produces this (you can see code snippets in the attached image):
- Camera.GetPicture allows the user to select an image
- This returns b64 data
- We use the file plugin to turn that b64 data into a file
- This returns a file URI
- We normalize the file URI using window.Ionic.WebView.convertFileSrc
- This normalizes the URI and we save the URI
- Finally, we use <img [src]=‘image.uri’> in the view to preview the image
This used to work great. In the past, the normalized URL would look something like:
Now, there is an odd file string in there:
This new format causes the app to crash as described above. What changed that causes this failure now?
If I use the raw file URI returned from b64toFile or manually remove the file/portion, the app no longer crashes, but instead of a preview of an image just a tiny blank box shows up.
Any idea what is going on here?