-1
我試圖在用戶點擊明星時將對象添加到plist。我在顯示另一個表格視圖中的對象時遇到了問題,我強烈懷疑這個方法中存在的問題。爲什麼我無法將對象添加到plist
-(IBAction)favbutton
{
NSString *path = [[NSBundle mainBundle] pathForResource: @"Favorites" ofType:@"plist"];
// Build the array from the plist ------>>>
NSDictionary *favs = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
favMutArray = [favs objectForKey:@"Name"];
[favMutArray addObject:stateName];
[favMutArray writeToFile:path atomically:YES];
NSLog(@"StateButtonFinished");
}
的按鈕conntected(從看到的NSLog),Statename的是一個NSString,並Favorites.plist含有上午根與姓名,電話,傳真和地址陣列。如果您需要更多信息,我可以提供。謝謝!
應用程序的資源包是隻讀的。 – rmaddy