I am having trouble importing an XML file back into my program, I have it saving OK, but I can't seem to get the strings contained in my plist back into an NSArray (myArray)
here is my code:
when I look at the logs, all I get returned are:
is there something obvious i am missing?
thanks in advance.
here is my code:
Code:
- (IBAction)importFile:(id)sender
{
NSOpenPanel *openPanel;
openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseDirectories:NO];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setResolvesAliases:YES];
[openPanel setCanChooseFiles:YES];
// Only allow the user to select our specific file type.
NSArray *fileTypes = [NSArray arrayWithObjects: @"bundle", nil];
if ([openPanel runModalForTypes:fileTypes] == NSOKButton)
{
NSString *importContentsPath = [[openPanel filename] stringByAppendingPathComponent:@"Contents"];
NSString *importResourcesPath = [importContentsPath stringByAppendingPathComponent:@"Resources"];
//import My strings into myArray
plistPath = [importResourcesPath stringByAppendingPathComponent:@"My.plist"];
NSArray *myArray = [[NSArray alloc] initWithContentsOfFile:[NSString stringWithFormat:@"plistPath"]];
NSLog:(@"contents of myArray %@", myArray);
}
}
when I look at the logs, all I get returned are:
Code:
contents of myArray (null)
is there something obvious i am missing?
thanks in advance.