Bundle.main.path(forResource:ofType:inDirectory:) returns nil

The issue is that the file isn’t being copied to your app bundle. To fix it:

  • Click your project
  • Click your target
  • Select Build Phases
  • Expand Copy Bundle Resources
  • Click ‘+’ and select your file.

Leave a Comment