2012-03-23 12 views
0

私は問題があります。このplistの後のplist - - NSMutableDictionaryは0x0

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"]; 
    NSString *settingPath = [[[NSString alloc] init] autorelease]; 
    settingPath = [[NSBundle bundleWithPath:filePath] pathForResource:@"Root" ofType:@"plist"]; 
    NSMutableDictionary *plist = [[[NSMutableDictionary alloc] init] autorelease]; 
    plist = [NSMutableDictionary dictionaryWithContentsOfFile:settingPath]; 

はnilで、住所イスト0x0の...しかし、なぜですか? 誰でも助けてくれますか?以下は

答えて

0

OKを動作するはずいくつかのコードです:plistのが有効でなければならないこと

NSString* path = [[NSBundle mainBundle] pathForResource:@"myfile" ofType:@"plist"]; 
NSDictionary* dictionary = [NSDictionary dictionaryWithContentsOfFile:path]; 

注、そうでなければ、NULL値を取得します。

また、別の呼び出しでその値を上書きする場合は、alloc/initを使用して変数を作成する必要はありません。

+0

質問は少し古いですが、はいです。これは数か月前に私のためにしました:-) –

関連する問題