I am trying to access an array that I am trying to have created from a plist.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *plistPath = [documentsDirectory stringByAppendingPathComponent:@"methodologyQuestions.plist"];
NSMutableArray *myArray = [[[NSMutableArray alloc] initWithContentsOfFile:plistPath]mutableCopy];
NSLog(@"%@", [myArray objectAtIndex:0]);
Here is a snapshot of my plist methodologyQuestions.plist
The problem is that when I log the array it is null. What am I doing wrong?
The problem is that you are reading from the wrong path. If this is a file bundled with your app then it is not in the Documents folder, it is in the app's resource bundle.
The path is:
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"methodologyQuestions" ofType:@"plist"];