ios 应用内购买恢复按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11021932/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In app purchases restore Button
提问by Alex G
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:
我第一次在应用程序购买中实施了我的应用程序更新,只等了 3 周,但由于以下原因被拒绝:
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:
现在我想在navbar
我的表格的右侧(顶部)添加一个按钮,可以看到/点击应用购买,并添加以下将链接到按钮的代码:
[[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!
有人可以验证这是正确的并且很可能是所有需要的吗?愿这次能顺利通过。提前致谢!
采纳答案by Nikita Pestrov
Alex, i've been rejected for the same reason last week, and this is right what Apple wanted - after adding such a Restorebutton 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).
当然,您不仅需要调用 ,还需要[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
自己实现恢复(我的意思是,将内容提供给用户)。
回答by Brian Noah
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.
对不起,如果这没有意义,我在我的 iPad 上。
回答by Roman B.
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).
替代恢复按钮可以是应用设置包中的恢复开关。它并没有压倒 UI,似乎 Apple 很欢迎它(但一定要提到你已经以这种方式实现了机制)。
BOOL shouldRestorePurchases = [[NSUserDefaults standardUserDefaults] boolForKey:@"restorePurchasesKey"];
回答by Jojodmo
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.
我也因为同样的原因被拒绝了。这是因为您可以Apple ID
在不同的 ios 设备上以相同的方式登录。
For example, let's say I'm logged into [email protected]
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 [email protected]
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
.
例如,假设我在[email protected]
iPad 上登录。当我下载您的应用程序时,我意识到我想删除广告(假设您的应用程序上没有广告),因此我将它们删除为99¢
. 一年后,我决定购买一部 iPhone,并登录[email protected]
该帐户,然后再次下载您的应用。尽管我已经为它们付费,但广告仍然存在。谁愿意为同样的东西支付两次?使用该restore
功能,我可以恢复iPad
在我的iPhone
.
To restore the purchase, you could use:
要恢复购买,您可以使用:
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
After that, you need to also provide the content that the user bought.
之后,您还需要提供用户购买的内容。