2017-08-25 11 views
-1

1または0を出力するのではなく、TrueまたはFalseを出力することはできません。Objective-c bool真と偽の秘密(NSDictionary)

は、ここに私の現在のコード

NSString *plistPath = @"/Library/Preferences/TestPlist.plist"; 
NSDictionary *plistData = [NSDictionary dictionaryWithContentsOfFile:plistPath]; 
NSString *tester = [plistData valueForKey:@"MyKeyOption"]; 
NSLog(@"%@", [NSString stringWithFormat:@"%@", tester]); 
_test.stringValue = tester; 

右方向に任意のヘルプは大歓迎だろうさ。

+2

https://stackoverflow.com/questions/6358349/how-to-print-boolean-flag-in-nslog –

+0

[NSLogのブールフラグを印刷するにはどうすればいいですか?](https://stackoverflow.com)/questions/6358349/how-to-print-boolean-flag-in-nslog) – waka

答えて

1

ブール値はNSNumberオブジェクトに簡単に変換できます。

@(YES)@(NO)

これは、あなたにBOOLバックを与えるboolValueメソッドを持つNSNumberオブジェクトを提供します。