[英]NSDictionary Key exists but returns nil
我有一本包含對象但返回nil的字典。
// returns nil
(lldb) po [_contentRatings objectForKey:rating]
nil
// this is the rating string
(lldb) po rating
'=7+’
// using a literal string works
(lldb) po [_contentRatings objectForKey:@"'=7+'"]
5
它一定不能喜歡引號,因為這會導致字符串相等性失敗:
(lldb) po @"'=7+'"
'=7+'
(lldb) po rating
'=7+’
(lldb) p (BOOL)[@"'=7+'" isEqualToString:rating]
(BOOL) $10 = NO
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.