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?
thanks!
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.
The answer marked as correct might not be right in all situations. If you have e.g. plists, Xcode 4.5+ will for some reason NOT copy it to the application bundle, even if everything else is right. A workaround is to rename your plist to .png and then rename it back later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With