开发者

iOS 4 won't load new property list

Have created a new property list, and deleted the original .plist (same filename). Deleted old file and moved to trash. Dropped in new file of same name.

When app opened in Simulator, the old .plist file loaded. What's going on?

Here is my code in the implementation file:

- (void)viewDidLoad {
[super viewDidLoad];

// Uncomment the following line to display an Edit button in 开发者_StackOverflow中文版the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
NSString *path = [[NSBundle mainBundle] pathForResource:@"DrinkArray" ofType:@"plist"];

    NSMutableArray *tmpArray = [[NSMutableArray alloc]

initWithContentsOfFile:path];

self.drinks = tmpArray;

[tmpArray release];

}


Open your plist file with a text editor. If root is set to dict, change it to array, also remember to change the bottom bracket at the end of the file. Save and rerun and it should be ok.

An alternative is to use an NSMutableDictionary since the plist root probably is already a dictionary.

I had the same problem and the above worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜