I'm looking for png-files in the folder Documents of my app and add their titles to the array. After calling the function array is still empty. Can you help me? I'm beginner in Obj-C. Thanks.
My function:
-(void)getphotolist{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSBundle *myBundle = [NSBundle bundleWithPath:documentsDirectory];
NSArray *mypngs = [myBundle pathsForResourcesOfType:@".png"
inDirectory:documentsDirectory];
NSMutableArray *photo_array = [[NSMutableArray alloc] init];
NSLog(documentsDirectory);
for (NSString *tString in mypngs) {
[photo_array addObject:tString];
for (id obj in photo_array)
{
NSLog(@"obj: %@", obj);
}
}
}