• Home
  • Q&A
  • xcode ios files not recognized in bundle

xcode ios files not recognized in bundle

April 13, 2012
2 score
1 answers

i want to play a video, but i noticed that my files are not importing to the bundle??

so I just drag and drop the AA.mp4 file to my project,

it shows ok on the project navigator, I give it show in finder, and confirm the file exists in the project

now, when i try this

 NSString *bundleRoot = [[NSBundle mainBundle] bundlePath];
    NSFileManager *fm = [NSFileManager defaultManager];
    NSArray *dirContents = [fm contentsOfDirectoryAtPath:bundleRoot error:nil];

    NSLog(@"content of bundle ::%@", dirContents);

to see the contents of my bundle, i see every other file, but not the one i have imported???

so what im i missing?



5 score

Simply dropping a file into an Xcode project is not enough. You must check your app target as the one receiving the file in the dialog box, else it will not be added to the 'copy bundle phase' and as a result, not copy over to your app. Go into build phases and drag your video into the copy bundle resources phase group, then clean and run again.

Though if you can see it's name in red in the file tree, it doesn't exist.

answered April 13, 2012