我只是想问是否有办法检查用户是否确实以编程方式购买了应用程序。我看到《无尽之剑 3》和其他游戏如何强迫用户登录他们的苹果帐户,并以某种方式向商店检查该应用程序是否已被购买。这怎么可能以编程方式创建?我在整个网络上进行了搜索,只是为了找到如何打开 storkit 视图,您可以从中购买其他应用程序或视频等...提前致谢
您可以尝试检查应用程序的收据并通过 AppStore 进行验证 -
NSURL* url = [[NSBundle mainBundle] appStoreReceiptURL]; // iOS 7+, do not use respondsToSelector as it will report YES for iOS 6 too
Here's 苹果的文档 https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html关于如何验证您的收据。
如果收据为 nil 或者 url 指向不存在的路径,您可能需要刷新收据。
实施SKRequestDelegate
并检查:
NSError* err = nil;
if (![url checkResourceIsReachableAndReturnError:&err]){
SKReceiptRefreshRequest* request = [[SKReceiptRefreshRequest alloc] initWithReceiptProperties:nil];
request.delegate = self; /* or your delegate's instance here */
[request start];
}
....
-(void)requestDidFinish:(SKRequest*)request{
if([request isKindOfClass:[SKReceiptRefreshRequest class]]){
// The URL should be available now, if it's not - I guess the app is cracked
}
}
-(void)request:(SKRequest*)request didFailWithError:(NSError *)error{
; // This does not mean the app is pirated, use this to schedule the test for later.
}
我会在调试模式下(以及在模拟器上)禁用这些检查。
您可能想检查这个项目 -验证商店收据iOS https://github.com/rmaddy/VerifyStoreReceiptiOS用于验证您的收据。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)