Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


modifying a plist is not working


modifying a plist is not working  using -'iphone,objective-c,ios,plist'

i have to modify a BOOL value in my plist file stored with the bundle.i am able to access the dictionary which i have to modify .from nslogging i can see that dict is updated with the new value ,but the problem is when i check the plist in bundle it is not being modified.any clue on why it is not updating the plist

  NSString* plistPath = nil;
        NSFileManager* manager = [NSFileManager defaultManager];
        if (plistPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"TopicsList.plist"])
        {
            if ([manager isWritableFileAtPath:plistPath])
            {
                NSMutableArray* dictarrays = [NSMutableArray arrayWithContentsOfFile:plistPath];
                NSMutableDictionary *dict=[dictarrays objectAtIndex:indexPath.row];
                NSLog(@"%@ ",dict );

                [dict setObject:[NSNumber numberWithBool:YES] forKey:@"isPaid"];

                NSLog(@"%@ ",dict );
                [dict writeToFile:plistPath atomically:NO];
                    NSLog(@"%@ ",dict );
                [manager setAttributes:[NSDictionary dictionaryWithObject:[NSDate date] forKey:NSFileModificationDate] ofItemAtPath:[[NSBundle mainBundle] bundlePath] error:&error];
            }
        }

    

asked Sep 22, 2015 by girisha
0 votes
10 views



Related Hot Questions



Government Jobs Opening


...