I wanted to populate a array with images in the folder which I directly dragged from my computer(folder name in compute:Assets) to xcode project.
This is the code which I wrote for that...
NSArray *dataArray = [[NSArray alloc]init];
NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Assets"];
NSLog(@"%@ SOURCE PATH",sourcePath);
NSError *error;
dataArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:sourcePath error:&error];
NSLog(@"error %@", error);
NSLog(@"%lu",(unsigned long)[self.dataArray count]);
But when I compile and run the application. The folder is not created in the app bundle, images inside it are just there in the app bundle outside of folder. And the folder Assets is not created in the app bundle.
The error I get is this:
error Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x7fbc4af19700 {NSFilePath=/Users/prajeetshrestha/Library/Developer/CoreSimulator/Devices/32774E43-6CAC-4091-B642-3001513F578A/data/Containers/Bundle/Application/E932A108-D07F-4985-A58D-2D3101F52D6A/TestPullData.app/Assets, NSUserStringVariant=( Folder ), NSUnderlyingError=0x7fbc4ad3ee90 "The operation couldn’t be completed. No such file or directory"}
Folder Structure in Xcode: http://i62.tinypic.com/mvgr4z.png
Folder Structure in App Bundle: http://i57.tinypic.com/34gsg3d.png