English 中文(简体)
将NSString变量列入清单
原标题:Error adding NSString variable into plist file

我提出了一个问题,我花了很多时间辛苦挣扎......请帮助。

I m 采用以下代码,在清单档案中添加记录:

[数据_appo setObject:@“string Value” forKey:[NSString stringWithFormat:@"%i”,(i-1)]

并做工。 现在,如果我试图从档案中读一下,而不是添加(我需要用不同的钥匙复制价值)如下:

NSString *string_appo=[data_appo ObjectForKey:[NSString stringWithFormat:@“%i”,j]

[data_appo setObject:string_appo forKey:[NSString stringWithFormat:@"%i",(i-1)]];

之后,I gest ERROR_EXEC and the appcock...

Any idea???

Any help will be appreciated

提前感谢!

问题回答

您在增补后保存了该名单。 我是这样做的。

     //find the plist file
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
        NSString *documentsDirectory = [paths objectAtIndex:0]; 
        NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Notes.plist"]; 
    //set the value for the key
        [notesData setValue:textView.text forKey:[NSString stringWithFormat:@"General notes %d",selectedIndex]];
    //save the plist file   
        [notesData writeToFile: path atomically:YES];
    //relese and reload it
        [notesData release];
        notesData = [[NSMutableDictionary alloc] initWithContentsOfFile: path];

我希望这一帮助!





相关问题
Xcode cannnot find my plist file when building

I m trying to build my app and every time I do I get this error: error: The file "Wallpapers-Info.plist" does not exist. Anyone know what causes this error? I have the wallpaper-info.plist file ...

Copying JSON response dictionary to plist

I have a dictionary containing a JSON response and a plist file. I want to update the values in my plist file with the JSON response values. How would I do this?

Use a Plist dictionary for App settings

I want to be able to use a plist for settings Im implementing in my app. I want a dictionary "Settings" to hold my arrays, such as "Debug", "Option 1", Option 2", etc. How would I access "Debug"array ...

How to add an extra plist property using CMake?

I m trying to add the item <key>UIStatusBarHidden</key><true/> to my plist that s auto-generated by CMake. For certain keys, it appears there are pre-defined ways to add an item; ...

Plist Hierarchy and All Option

I have a string of data in a plist, which I ve got to display, hierarchically like this: Menu>Chapter>SubChapter>item>item details This might be super simple, in my initial menu, how would I have ...

热门标签