に認識されていないセレクタがまあ、私のコードは次のようだったnsnullをisEqualToStringは:</p> <p>私はこのようにそれらを使用しています<code>place and date.</code> 2つの文字列があります:にObjC
cell.datePlace.text= [NSString stringWithFormat:@"%@, %@",date,place];
をいくつかのエントリでは、出力は次のようです:
"21/10/2012, <null>"
"21/11/2012, None"
"21/12/2013, London"
私のアプリはクラッシュしませんが、ヌルではなく、Noneでない場合にのみ表示されます。
だから私はこれを試してみました。場所は<null>
私のアプリがクラッシュし、私はこのエラーましたとき
NSString * place=[photo objectForKey:@"place"];
if ([place isEqualToString:@"None"]) {
cell.datePlace.text= [NSString stringWithFormat:@"%@",date];
} else {
cell.datePlace.text= [NSString stringWithFormat:@"%@, %@",date,place];
}
問題ました:だから
[NSNull isEqualToString:] unrecognized selector send to instance
を、私はこれを試してみました:
if (place) {
if ([place isEqualToString:@"None"]) {
cell.datePlace.text= [NSString stringWithFormat:@"%@",date];
} else {
cell.datePlace.text= [NSString stringWithFormat:@"%@, %@",date,place];
}
} else {
cell.datePlace.text= [NSString stringWithFormat:@"%@",date];
}
しかし、問題は残っています。
はい、JSONから来ています。それは今働いている。私は答えを受け入れるだろう! – ghostrider
'NSNull'はシングルトンオブジェクトなので、' place == [NSNull null] 'と比較することができます。 –
偉大な答え。私は上向きにした – user3182143