Bundles and file access

后端 未结 3 1078
南方客
南方客 2021-02-06 17:35

I\'ve adding a series of folders to my project (using the Add existing file option). This results in the folder contents being shown in Xcode as a blue folder.

The follo

3条回答
  •  孤街浪徒
    2021-02-06 18:24

    The problem with your imageWithContentsOfFile code is that you're assuming that / is the root of the bundle, when it's the root of the FS!

    So, pathForResource:ofType:inDirectory: is probably the easiest way to get the path you need.

    Otherwise, you can get the root of the bundle and prefix that to your paths.

提交回复
热议问题