NSNull isEqualToString Issue With JSON Response
- by IconicDigital
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"];
}