In app purchases restore Button

2019-01-21 02:23发布

I have implemented in app purchases into my app update for the first time, only too wait 3 weeks and have it rejected for the following reason:

We found that your app offers In-App Purchase/s that can be restored but it does not include a "Restore" feature to allow users to restore the previously purchased In-App Purchase/s. To restore previously purchased In-App Purchase products, it would be appropriate to provide a "Restore" button and initiate the restore process when the "Restore" button is tapped.

Now I was thinking of adding a navbar button to the right (top) of my table where the app purchases can be seen/tapped and adding the following code that will be linked to the button:

 [[SKPaymentQueue defaultQueue]   restoreCompletedTransactions];

Can someone verify that this is correct and most likely all that is needed? Would like this to pass successfully this time. Thanks in advance!

4条回答
趁早两清
2楼-- · 2019-01-21 02:37

I've been rejected for the same reason. It's due to the fact that you can be signed in with the same Apple ID on different ios devices.

For example, let's say I'm logged into test@iCloud.com on an iPad. When I download your application I realize that I would like to remove the ads (let's say you have ads on your app if you don't), so I remove them for 99¢. One year later, I decide to buy an iPhone, and sign into test@iCloud.com on that account, and I download your app again. The ads are still there, though, even though I already payed for them. Who would like to pay for the same thing twice? With the restore feature, I can restore the purchases that I made on my iPad, and make them work on my iPhone.

To restore the purchase, you could use:

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

After that, you need to also provide the content that the user bought.

查看更多
来,给爷笑一个
3楼-- · 2019-01-21 02:41

Alex, i've been rejected for the same reason last week, and this is right what Apple wanted - after adding such a Restore button they didn't ask any other question on this subject.

Of course, you need not only to call [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];, but implement the restoring itself too (i mean, providing the content to user).

查看更多
贪生不怕死
4楼-- · 2019-01-21 02:42

I use a variation of this:

//inside of an IBaction
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue]restoreCompletedTransactions];


// Then this is called
- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
    NSLog(@"%@",queue );
    NSLog(@"Restored Transactions are once again in Queue for purchasing %@",[queue transactions]);  

    NSMutableArray *purchasedItemIDs = [[NSMutableArray alloc] init];
    NSLog(@"received restored transactions: %i", queue.transactions.count);

    for (SKPaymentTransaction *transaction in queue.transactions) {
        NSString *productID = transaction.payment.productIdentifier;
        [purchasedItemIDs addObject:productID];
        NSLog (@"product id is %@" , productID);
        // here put an if/then statement to write files based on previously purchased items
        // example if ([productID isEqualToString: @"youruniqueproductidentifier]){write files} else { nslog sorry}
    }  
}

Sorry, I'm on my iPad if this makes no sense.

查看更多
ら.Afraid
5楼-- · 2019-01-21 02:54

Alternative to restore button could be a restore switch in app settings bundle. It does not overwhelm UI and seems like Apple welcomes it (but be sure to mention that you have implemented mechanics this way).

BOOL shouldRestorePurchases = [[NSUserDefaults standardUserDefaults] boolForKey:@"restorePurchasesKey"];
查看更多
登录 后发表回答