1
私はここに非常に基本的な何かが欠けていると思うが、ここでは行きます。initWithContentsOfFile:エンコーディング:エラー: - NSInvalidArgumentException
Xcodeでインラインヘルプは、initWithContentsOfFileと言われます:はがinitWithContentsOfFile 代わりを
NSMutableDictionary *myDict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
を非推奨:エンコーディング:エラー:を使用する必要があります。
NSMutableDictionary *myDict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath encoding:NSUTF8StringEncoding error:NULL];
私の問題は、そのinitWithContentsOfFileです:以下のコードはエラーを発生させながら、正常に動作し。
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"prefs" ofType:@"plist"];
Load preferences into symbol dictionary
NSMutableDictionary *myDict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath encoding:NSUTF8StringEncoding error:NULL];
ERROR:クリスが私に指摘したように
2011-12-08 16:27:12.209 -[__NSPlaceholderDictionary initWithContentsOfFile:encoding:error:]: unrecognized selector sent to instance 0x4b2a370
2011-12-08 16:27:12.212 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSPlaceholderDictionary initWithContentsOfFile:encoding:error:]: unrecognized selector sent to instance 0x4b2a370'
対象とするIOSのバージョンは次のとおりです。限り、バージョン2.0の後に私は[[NSMutableDictionary alloc] initWithContentsOfFile:filePath]をすべて知ることができます。ドキュメントは[こちら](http://developer.apple.com/library/IOs/#documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html#//apple_ref/occ/cl/NSDictionary)です。 initWithContentsOfFile:encoding:NSDictionaryのドキュメンテーションのエラーについては言及していないので、私はそれを明確にします。 –
返事のためのタクク!私はIOS 4.3のために午前中です。 – Kermit
私は今NSDictionaryを使用していますが、XCodeの警告はNSStringのためのものであることに気付きました。奇妙な。クリスおかげで再び! – Kermit