重複の可能性:
Objective-C での NSString の比較について
コード
NSString *nodeType = [subNodeDict objectForKey:@"nodeType"];
NSLog (@"nodeType = %@", nodeType);
NSLog (@"(nodeType == @\"Collection\") = %d", nodeType == @"Collection");
NSLog (@"[nodeType class] = %@ and [@\"Collection\" class] = %@", [nodeType class], [@"Collection" class]);
ログ
2013-01-01 04:06:37.895 GoogleClient[4752:c07] <strong>nodeType = Collection
2013-01-01 04:06:37.896 GoogleClient[4752:c07] <strong>(nodeType == @"Collection") = 0
2013-01-01 04:06:37.896 GoogleClient[4752:c07]
<strong>[nodeType class] = __NSCFString and [@"Collection" class] = __NSCFConstantString
subNodeDict
AFNetworking を介してサーバーから返される JSON 応答オブジェクトです。
サーバーから返された文字列を定数文字列と正確に比較する方法がわかりません。subNodeDict 内のすべての非文字列オブジェクトは正常に機能します。使用する必要がある UTF-8 エンコーディングのタイプはありますか? 真の値 nodeType を取得するにはどうすればよいですか?