App crashes when attempting to preview image using a URI with a img element

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

  1. Camera.GetPicture allows the user to select an image
  2. This returns b64 data
  3. We use the file plugin to turn that b64 data into a file
  4. This returns a file URI
  5. We normalize the file URI using window.Ionic.WebView.convertFileSrc
  6. This normalizes the URI and we save the URI
  7. 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?