ios - In App Purchase - Help on Last stage - downloading content -
i have implemented iap app having problem figuring out user supposed find purchased content after pay.
using test account, when click buy button, marks iap tick if show bought there can't find content...
can assist me need add code , storyboard user able access purchased content.... (the content several short videos available user through iap)
from have read through tutorials, think code im missing this:
-(void)paymentqueueskpaymentqueue *)queue updateddownloadsnsarray *)downloads { (skdownload *download in downloads) { switch (download.downloadstate) { case skdownloadstateactive: nslog(@"download progress = %f", download.progress); nslog(@"download time = %f", download.timeremaining); break; case skdownloadstatefinished: // download complete. content file url @ // path referenced download.contenturl. move // somewhere safe, unpack , give user // access break; default: break; } } }
however need method transfer completed downloads app , link view controller downloads/purchased content (how do this?)
here sample code 1 of apps you. have determine index of product purchased , provide content based on that. if have 1 in-app purchase can provide content after purchase notification.
- (void)productpurchased:(nsnotification *)notification { [self makesuccessalert]; nsstring * productidentifier = notification.object; [_products enumerateobjectsusingblock:^(skproduct * product, nsuinteger idx, bool *stop) { if ([product.productidentifier isequaltostring:productidentifier]) { if (idx == 0) { coins = [nsnumber numberwithinteger:[coins integervalue] + 5000]; nslog(@"coins %d", [coins integervalue]); [totalcoins setstring:[nsstring stringwithformat:@"%d", coins.integervalue]]; [[nsuserdefaults standarduserdefaults] setobject:coins forkey:@"coins"]; [[nsuserdefaults standarduserdefaults] synchronize]; } if (idx == 1) { coins = [nsnumber numberwithinteger:[coins integervalue] + 15000]; nslog(@"coins %d", [coins integervalue]); [totalcoins setstring:[nsstring stringwithformat:@"%d", coins.integervalue]]; [[nsuserdefaults standarduserdefaults] setobject:coins forkey:@"coins"]; [[nsuserdefaults standarduserdefaults] synchronize]; } *stop = yes; } }];
}