Search code examples
iosxcodensbundle

File deleted from App Bundle in Xcode still readable


I have a bunch of Audio Files in my App Bundle, I was reading using

 [[NSBundle mainBundle] pathForResource:aaa ofType:m4a]

I found that even if I delete the aaa.m4a by moving to trash my app is can read and play the audio file (using AVAudioPlayer). I checked by search in the Xcode project's directory, that it doesn't exist. I checked also from Build Phrases - Copy Bundle Resources, that aaa.m4a is not there.

Anybody has any ideas why?


Solution

  • File is kept somewhere during build & run process.

    • In Xcode Go to Organizer > Projects > Your project > Remove Derived Data
    • On your device Delete app

    Run on device and you should be fine.