I have a problem with initializing player with MP3 file that have space in path, for example:
/Users/username/Library/Developer/CoreSimulator/Devices/186A325C-45B8-4FF4-861E-8A582D90BCAC/data/Containers/Data/Application/4D4792DA-3135-4695-9457-08A912B237E6/Documents/subfolder/Name of the file with spaces.mp3
The app crashes giving me following Error:
Fatal error: Unexpectedly found nil while unwrapping an Optional value
This problem only occurs on ios and only with files that have spaces in path. On android everything works fine.
App crash occurs in
RNTrackPlayer/Models/MediaURL.swift
Line 28: value = URL(string: url)!
Here is the screenshot from XCode with crash: https://imgur.com/a/YD2lk
encodeURI for path solved the problem, it should be noted in documentation, that I need to encode string before adding track to the queue, instead I had to look deeper into other issues few moths ago and read that encoding has been removed from code.
Most helpful comment
encodeURI for path solved the problem, it should be noted in documentation, that I need to encode string before adding track to the queue, instead I had to look deeper into other issues few moths ago and read that encoding has been removed from code.