NSNull isEqualToString Issue With JSON Response
Posted
by
IconicDigital
on Stack Overflow
See other posts from Stack Overflow
or by IconicDigital
Published on 2012-12-05T16:25:25Z
Indexed on
2012/12/05
17:04 UTC
Read the original article
Hit count: 218
I am getting the following error
-[NSNull isEqualToString:]: unrecognized selector sent to instance 0x3c168090
on this line of code
cell.offerTitle.text = [voucherData objectForKey:@"offer_title"];
Could someone help me correct the problem please?
Thanks Oliver
* Update **
NSlog [voucherData objectForKey:@"offer_title"] and I get the following
2012-12-05 16:50:17.512 app.co.uk - Vouchers and Deals[6350:907] <null>
2012-12-05 16:50:17.514 app.co.uk - Vouchers and Deals[6350:907] -[NSNull isEqualToString:]: unrecognized selector sent to instance 0x3c168090
Checked the JSON and there was a null value, I have done the following to check if null but this isn't working
if([voucherData objectForKey:@"offer_title"] == NULL){
cell.offerTitle.text = @"INVALID";
}else{
cell.offerTitle.text = [voucherData objectForKey:@"offer_title"];
}
© Stack Overflow or respective owner