1

我想知道如何构建一个从设置中读取文本/字符串的应用程序。是的,这仅适用于越狱设备。是的,我知道我不能把它放到应用商店。

我已经知道如何用 int 或 bool 来做,但我对字符串没有任何想法,请帮助我!这是代码:

int F1;
bool F2;

这是它的读取方式:

F1 = [[[NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.xx.pxx.plist"]valueForKey:@"kF1"]intValue];
F2 = [[[NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.xx.pxx.plist"]objectForKey:@"kF2"]boolValue];

EDIT1:以及我必须如何或在设置 plist 中更改什么:

    <dict>
        <key>cell</key>
        <string>PSSwitchCell</string>
        <key>default</key>
        <true/>
        <key>defaults</key>
        <string>com.xx.pxx</string>
        <key>key</key>
        <string>kF1</string>
        <key>label</key>
        <string>Activate the tool</string>
    </dict>
4

1 回答 1

1

对于字符串:

NSString *string = [[NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.xx.pxx.plist"]objectForKey:@"kF2"];
于 2013-04-02T17:10:43.320 回答