ios - Cannot get SKProductsResponse products: response.count = 0 -


i've added iap in app , error.

- (void)getproductid { //runs on viewdidload     if ([skpaymentqueue canmakepayments]) {         skproductsrequest *request = [[skproductsrequest alloc] initwithproductidentifiers:[nsset setwithobjects:_productid, nil]];         request.delegate = self;          [request start];     } else {         [[[uialertview alloc] initwithtitle:@"serpentine" message:@"error: not connect store. try enabling in-app-purchases in settings." delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil] show];          [self couldnotconnecttostore];     }  }  - (void)paymentqueue:(skpaymentqueue *)queue updatedtransactions:(nsarray *)transactions {     (skpaymenttransaction *transaction in transactions) {         switch (transaction.transactionstate) {             case skpaymenttransactionstatepurchased:[self unlockpurchase];                 [[skpaymentqueue defaultqueue] finishtransaction:transaction];              case skpaymenttransactionstatefailed:nslog(@"transation failed");                 [[skpaymentqueue defaultqueue] finishtransaction:transaction];              default:break;         }     } }  - (void)productsrequest:(skproductsrequest *)request didreceiveresponse:(skproductsresponse *)response {     nsarray *products = response.products;      if (products.count != 0) {         _product = products[0];         _allowpurchase = yes;     } else {         [[[uialertview alloc] initwithtitle:@"serpentine" message:@"error: not connect store" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil] show];//this line of code runs second after controller opens  //****************** error on line above *********************************          [self couldnotconnecttostore];     }      products = response.invalidproductidentifiers;      (skproduct *product in products) {         nslog(@"product not found: %@", product);     } }   - (ibaction)purchasebuttonpressed:(uibutton *)sender {     if (sender.tag == 1) {         //buy 20         _productid = @"com.piguygames.serpentine.buy20";          skpayment *payment = [skpayment paymentwithproduct:_product];         [[skpaymentqueue defaultqueue] addpayment:payment];      } else if (sender.tag == 2) {         //buy 45     } else if (sender.tag == 3) {         //buy 100     } else if (sender.tag == 4) {         //double     } else if (sender.tag == 5) {         //remove ads     } } 

note: there other code in controller, don't think relevant.

i have added in app purchase itunes connect , says "ready submit". should fine here? got warning on same site saying must submit new version of app in app purchases working. decided submit app , disable iap in app first, release iap in later update. need submit new version test iap?

anyway, there problems can see far?

please ask more information if there more needed, beginner topic. thanks

make sure you're signed out of itunes account in settings app, unless it's test account created in itunes connect. had exact same problem , that's how solved it.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -