views:

103

answers:

1

I am trying to build a UITableView which just goes really weird? Here is the line it crashes at:

bookmarksList = [[NSArray alloc] initWithContentsOfFile:[self saveFilePath]];

I have the bookmarksList declaired as an NSArray in the header file, so thats all good. The method saveFilePath is as follows and works for actually saving a file, so i don't see why it should't work for reading one?

- (NSString *)saveFilePath
{
NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
return [[pathArray objectAtIndex:0] stringByAppendingPathComponent:@"bookmarks.plist"];
}

Does anybody have an idea what on earth is going wrong? :(

UPDATE I tried changing the code to this, but still same thing

NSArray *data = [[NSArray alloc] initWithContentsOfFile:[self saveFilePath]];
    bookmarksList = [[NSMutableArray alloc] initWithArray:data];
    [data release];
A: 

All sorted, thanks for those who helped

tarnfeld