Some people know how to use plist??有人知道 怎麼從plist讀取字串嗎??

有人知道 怎麼從plist讀取字串嗎??
Some people know how to use plist??

我有去查過 這是我讀取plist的程式碼.
my .cpp Code

    const char *optionPlistPath = CCFileUtils::fullPathFromRelativePath("Property List.plist");

    CCDictionary *dictionary = CCFileUtils::dictionaryWithContentsOfFile(optionPlistPath);
    CCDictionary *miniDict = (CCDictionary*)( dictionary->objectForKey("1") );

    int somethingInteger = ((CCString*)miniDict->objectForKey("1"))->toInt();
    CCLOG("%d", somethingInteger);

這是我的plist
This my Property List.plist.

    1
    
        123
        456

請問我有哪邊打錯??或是少加些東西嗎?
Which wrong with my code?? help~~

in your PLIST, the key “1” containt an Array.

and you cast it to a Dictionnary.

i think it’s probably the problem…

try to use a CCArray instead (and access its values with objectAtIndex)

thank you help me
I Upload my simple PlistEX For everyone :slight_smile:

and this is my .plist