Question regarding iPhone error -
when run below code gives response on device....
- (void) requestproductdata { // nsstring *str = [[nsstring alloc] initwithformat:@"com.mycompany.inapppurchasetesting.productid"];//same product id displayed in itunes connect//"]; skproductsrequest *request= [[skproductsrequest alloc] initwithproductidentifiers:[nsset setwithobject:str]]; request.delegate = self; [request start]; // //nsset *productids = [nsset setwithobjects:@"com.mycompany.inapppurchasetesting.productid", nil]; //skproductsrequest *request = [[skproductsrequest alloc] initwithproductidentifiers:productids]; //request.delegate = self; nslog(@"requesting"); //[request start]; } - (void)productsrequest:(skproductsrequest *)request didreceiveresponse:(skproductsresponse *)response { nsarray *myproduct = response.products; nsarray *myinvalidproducts = response.invalidproductidentifiers; nslog(@"did recieve response"); nslog(@"response count %d",response.products.count); nslog(@"invalid response count %d",response.invalidproductidentifiers.count); (int = 0; i<myproduct.count; i++) { nslog(@"t:%@",[[myproduct objectatindex:i] localizedtitle]); } for(int = 0; < myinvalidproducts.count; ++i) { nslog(@"invalid products:%@",[[myinvalidproducts objectatindex:i] localizedtitle]); } // populate ui [request autorelease]; }
2010-11-16 14:14:46.028 inapppurchasetesting[7357:307] view loaded
2010-11-16 14:14:46.164 inapppurchasetesting[7357:307] requesting
2010-11-16 14:14:46.196 inapppurchasetesting[7357:307] can make payments
2010-11-16 14:14:52.135 inapppurchasetesting[7357:307] did recieve response
2010-11-16 14:14:52.146 inapppurchasetesting[7357:307] response count 0
2010-11-16 14:14:52.152 inapppurchasetesting[7357:307] invalid response count 1
2010-11-16 14:14:52.160 inapppurchasetesting[7357:307] -[nscfstring localizedtitle]: unrecognized selector sent instance 0x114990
2010-11-16 14:14:52.181 inapppurchasetesting[7357:307] * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[nscfstring localizedtitle]: unrecognized selector sent instance 0x114990'
why above error occurs...
please guide me out...
because invalidproductidentifiers
contains array of nsstring
s, not skproduct
s.
nslog(@"invalid products:%@",[myinvalidproducts objectatindex:i]);
Comments
Post a Comment