ios - "In App Purchasing" still wont work after trying all these steps -


i have carried out these several steps 5 non consumable in app purchases available within app still nothing showing when go tableviewcontroller linked iap code to... (i give big tutorial followed has got me far raywenderlich)

  • -made new app id
  • -successfully followed steps linking , downloading certificates
  • changed bundle id on xcode project 1 made app on ios developer portal
  • -linked devices , made test user account
  • -made non consumable iap on itunes connect , used identifiers within iap coding
  • -signed phone out of itunes account tht ready used test account
  • -coding iap looks correct store kit imported , product identifiers implemented within .m file
  • -waited 24 hours newly created iap sync itunes connect
  • -i didnt upload binaries!
  • i have hosting apple turned on didnt upload - issue?
  • i deleted app on phone , reinstalled testing still nothing

all when successfull run build page looks loading nothing blank page can pull down refresh on still nothing no iap created.

any suggestions of else can or add , if need me upload codes files can do...

coding iap within viewcontroller.h file

#import "accounts/accounts.h" #import <foundation/foundation.h> #import <storekit/storekit.h>  @interface viewcontroller19 : uitableviewcontroller  @end 

coding iap within viewcontroller.m file

#import "detailviewcontroller.h" #import "secretsiaphelper.h" #import <storekit/storekit.h>  @interface viewcontroller19 () {     nsarray *_products;     nsnumberformatter * _priceformatter; } @end  @implementation viewcontroller19  - (void)viewdidload {     [super viewdidload];      self.title = @"xxxxxxxxxxxxx";      self.refreshcontrol = [[uirefreshcontrol alloc] init];     [self.refreshcontrol addtarget:self action:@selector(reload) forcontrolevents:uicontroleventvaluechanged];     [self reload];     [self.refreshcontrol beginrefreshing];      _priceformatter = [[nsnumberformatter alloc] init];     [_priceformatter setformatterbehavior:nsnumberformatterbehavior10_4];     [_priceformatter setnumberstyle:nsnumberformattercurrencystyle];      self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"restore" style:uibarbuttonitemstylebordered target:self action:@selector(restoretapped:)];  }  - (void)restoretapped:(id)sender {     [[secretsiaphelper sharedinstance] restorecompletedtransactions]; }  - (void)viewwillappear:(bool)animated {     [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(productpurchased:) name:iaphelperproductpurchasednotification object:nil]; }  - (void)viewwilldisappear:(bool)animated {     [[nsnotificationcenter defaultcenter] removeobserver:self]; }  - (void)productpurchased:(nsnotification *)notification {      nsstring * productidentifier = notification.object;     [_products enumerateobjectsusingblock:^(skproduct * product, nsuinteger idx, bool *stop) {         if ([product.productidentifier isequaltostring:productidentifier]) {             [self.tableview reloadrowsatindexpaths:@[[nsindexpath indexpathforrow:idx insection:0]] withrowanimation:uitableviewrowanimationfade];             *stop = yes;         }     }];  }  - (void)reload {     _products = nil;     [self.tableview reloaddata];     [[secretsiaphelper sharedinstance] requestproductswithcompletionhandler:^(bool success, nsarray *products) {         if (success) {             _products = products;             [self.tableview reloaddata];         }         [self.refreshcontrol endrefreshing];     }]; }  #pragma mark - table view  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 1; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return _products.count; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell" forindexpath:indexpath];      skproduct * product = (skproduct *) _products[indexpath.row];     cell.textlabel.text = product.localizedtitle;     [_priceformatter setlocale:product.pricelocale];     cell.detailtextlabel.text = [_priceformatter stringfromnumber:product.price];      if ([[secretsiaphelper sharedinstance] productpurchased:product.productidentifier]) {         cell.accessorytype = uitableviewcellaccessorycheckmark;         cell.accessoryview = nil;     } else {         uibutton *buybutton = [uibutton buttonwithtype:uibuttontyperoundedrect];         buybutton.frame = cgrectmake(0, 0, 72, 37);         [buybutton settitle:@"buy" forstate:uicontrolstatenormal];         buybutton.tag = indexpath.row;         [buybutton addtarget:self action:@selector(buybuttontapped:) forcontrolevents:uicontroleventtouchupinside];         cell.accessorytype = uitableviewcellaccessorynone;         cell.accessoryview = buybutton;     }      return cell; }  - (void)buybuttontapped:(id)sender {      uibutton *buybutton = (uibutton *)sender;     skproduct *product = _products[buybutton.tag];      nslog(@"buying %@...", product.productidentifier);     [[secretsiaphelper sharedinstance] buyproduct:product];  }  @end 

coding iap within iaphelper.h file

#import <foundation/foundation.h> #import <storekit/storekit.h>  uikit_extern nsstring *const iaphelperproductpurchasednotification;  typedef void (^requestproductscompletionhandler)(bool success, nsarray * products);  @interface iaphelper : nsobject  - (id)initwithproductidentifiers:(nsset *)productidentifiers; - (void)requestproductswithcompletionhandler:(requestproductscompletionhandler)completionhandler; - (void)buyproduct:(skproduct *)product; - (bool)productpurchased:(nsstring *)productidentifier; - (void)restorecompletedtransactions;   @end 

coding iap within iaphelper.m file

#import "iaphelper.h" #import <storekit/storekit.h>  nsstring *const iaphelperproductpurchasednotification = @"iaphelperproductpurchasednotification";  // 2 @interface iaphelper () <skproductsrequestdelegate, skpaymenttransactionobserver> @end  // 3 @implementation iaphelper {     skproductsrequest * _productsrequest;     requestproductscompletionhandler _completionhandler;      nsset * _productidentifiers;     nsmutableset * _purchasedproductidentifiers; }  - (id)initwithproductidentifiers:(nsset *)productidentifiers {      if ((self = [super init])) {          // store product identifiers         _productidentifiers = productidentifiers;          // check purchased products         _purchasedproductidentifiers = [nsmutableset set];         (nsstring * productidentifier in _productidentifiers) {             bool productpurchased = [[nsuserdefaults standarduserdefaults] boolforkey:productidentifier];             if (productpurchased) {                 [_purchasedproductidentifiers addobject:productidentifier];                 nslog(@"previously purchased: %@", productidentifier);             } else {                 nslog(@"not purchased: %@", productidentifier);             }         }          // add self transaction observer         [[skpaymentqueue defaultqueue] addtransactionobserver:self];      }     return self;  }  - (void)requestproductswithcompletionhandler:(requestproductscompletionhandler)completionhandler {       // 1     _completionhandler = [completionhandler copy];      // 2     _productsrequest = [[skproductsrequest alloc] initwithproductidentifiers:_productidentifiers];     _productsrequest.delegate = self;     [_productsrequest start];  }  - (bool)productpurchased:(nsstring *)productidentifier {     return [_purchasedproductidentifiers containsobject:productidentifier]; }  - (void)buyproduct:(skproduct *)product {      nslog(@"buying %@...", product.productidentifier);      skpayment * payment = [skpayment paymentwithproduct:product];     [[skpaymentqueue defaultqueue] addpayment:payment];  }  #pragma mark - skproductsrequestdelegate  - (void)productsrequest:(skproductsrequest *)request didreceiveresponse:(skproductsresponse *)response {      nslog(@"loaded list of products...");     _productsrequest = nil;      nsarray * skproducts = response.products;     (skproduct * skproduct in skproducts) {         nslog(@"found product: %@ %@ %0.2f",               skproduct.productidentifier,               skproduct.localizedtitle,               skproduct.price.floatvalue);     }      _completionhandler(yes, skproducts);     _completionhandler = nil;  }  - (void)request:(skrequest *)request didfailwitherror:(nserror *)error {      nslog(@"failed load list of products.");     _productsrequest = nil;      _completionhandler(no, nil);     _completionhandler = nil;  }  #pragma mark skpaymenttransactionobserver  - (void)paymentqueue:(skpaymentqueue *)queue updatedtransactions:(nsarray *)transactions {     (skpaymenttransaction * transaction in transactions) {         switch (transaction.transactionstate)         {             case skpaymenttransactionstatepurchased:                 [self completetransaction:transaction];                 break;             case skpaymenttransactionstatefailed:                 [self failedtransaction:transaction];                 break;             case skpaymenttransactionstaterestored:                 [self restoretransaction:transaction];             default:                 break;         }     }; }  - (void)completetransaction:(skpaymenttransaction *)transaction {     nslog(@"completetransaction...");      [self providecontentforproductidentifier:transaction.payment.productidentifier];     [[skpaymentqueue defaultqueue] finishtransaction:transaction]; }  - (void)restoretransaction:(skpaymenttransaction *)transaction {     nslog(@"restoretransaction...");      [self providecontentforproductidentifier:transaction.originaltransaction.payment.productidentifier];     [[skpaymentqueue defaultqueue] finishtransaction:transaction]; }  - (void)failedtransaction:(skpaymenttransaction *)transaction {      nslog(@"failedtransaction...");     if (transaction.error.code != skerrorpaymentcancelled)     {         nslog(@"transaction error: %@", transaction.error.localizeddescription);     }      [[skpaymentqueue defaultqueue] finishtransaction: transaction]; }  - (void)providecontentforproductidentifier:(nsstring *)productidentifier {      [_purchasedproductidentifiers addobject:productidentifier];     [[nsuserdefaults standarduserdefaults] setbool:yes forkey:productidentifier];     [[nsuserdefaults standarduserdefaults] synchronize];     [[nsnotificationcenter defaultcenter] postnotificationname:iaphelperproductpurchasednotification object:productidentifier userinfo:nil];  }  - (void)restorecompletedtransactions {     [[skpaymentqueue defaultqueue] restorecompletedtransactions]; } @end 

coding iap within secretsiaphelper.h file

#import "iaphelper.h"  @interface secretsiaphelper : iaphelper  + (secretsiaphelper *)sharedinstance;  @end 

coding iap within secretsiaphelper.m file

#import "secretsiaphelper.h"  @implementation secretsiaphelper  + (secretsiaphelper *)sharedinstance {     static dispatch_once_t once;     static secretsiaphelper * sharedinstance;     dispatch_once(&once, ^{         nsset * productidentifiers = [nsset setwithobjects:                                       @"com.designsbydeondrae.xxxxxxx.remove_ads",                                       @"com.designsbydeondrae.xxxxxxx.foundationskills",                                       @"com.designsbydeondrae.xxxxxxx.intermediateskills",                                       @"com.designsbydeondrae.xxxxxxx.allskills",                                       @"com.designsbydeondrae.xxxxxxx.advancedskills",                                       nil];         sharedinstance = [[self alloc] initwithproductidentifiers:productidentifiers];     });     return sharedinstance; }   @end 

coding iap within detailviewcontroller.h file

#import <uikit/uikit.h>  @interface detailviewcontroller : uiviewcontroller  @property (strong, nonatomic) id detailitem;  @property (weak, nonatomic) iboutlet uilabel *detaildescriptionlabel;  @end 

coding iap within detailviewcontroller.h file

#import "detailviewcontroller.h"  @interface detailviewcontroller () - (void)configureview; @end  @implementation detailviewcontroller  #pragma mark - managing detail item  - (void)setdetailitem:(id)newdetailitem {     if (_detailitem != newdetailitem) {         _detailitem = newdetailitem;          // update view.         [self configureview];     } }  - (void)configureview {     // update user interface detail item.      if (self.detailitem) {         self.detaildescriptionlabel.text = [self.detailitem description];     } }  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib.     [self configureview]; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  @end 

so summarise...

  • used storekit access in-app purchase apis , retrieve list brings nothing when run build
  • specified product identifiers app
  • displaying products seems issue though show screen load nothing page pull refresh on it

for 1 finds post in future, reason no items showing when requesting iap due content not being uploaded hosted content.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -