简体   繁体   English

如何确定是否使用Apple的批量购买教育计划购买了应用程序?

[英]How can I tell if an app was purchased using Apple's volume purchase program for education?

I have an app that has been available in the AppStore for a while now. 我有一个已在AppStore中使用了一段时间的应用程序。
I can see from the iTunes reports that it's been purchased using Apple's volume purchase program , which is great, however - I would like to know if a certain device is running a volume purchased app or a standard AppStore app. 我从iTunes的报告中可以看到,它是使用Apple的批量购买程序购买的 ,这很棒,但是-我想知道某个设备是在运行批量购买的应用程序还是标准的AppStore应用程序。
I tried prying inside the receipt ( [[NSBundle mainBundle] appStoreReceiptURL] ) but I couldn't find anything informative. 我尝试在收据( [[NSBundle mainBundle] appStoreReceiptURL] )中进行[[NSBundle mainBundle] appStoreReceiptURL]但找不到任何有用的信息。
Creating a different bundle ID for this purpose is not an option, and kind of misses the idea of the VPP so, please - don't offer it. 为此目的,创建另一个捆绑包ID是不可行的,并且会遗漏VPP的想法,请-不要提供它。
Is there a programatic way to tell if the app was purchased using the VPP? 是否可以通过编程方式得知该应用是否是使用VPP购买的?

You were right to look inside the app receipt for VPP information, but you need to refresh it with the SKReceiptPropertyIsVolumePurchase flag set first: 您可以在应用收据中查看VPP信息,但是您需要首先设置SKReceiptPropertyIsVolumePurchase标志来刷新它:

self.refresh = [[SKReceiptRefreshRequest alloc] initWithReceiptProperties:@{SKReceiptPropertyIsVolumePurchase : @YES}];
self.refresh.delegate = self;
[self.refresh start];

You then get your receipt data in requestDidFinish: 然后,您可以在requestDidFinish:获取收据数据requestDidFinish:

- (void)requestDidFinish:(SKRequest *)request {
    NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
    NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
    // decode receipt and examine vpp fields here 
}

There are many ways to decode an apple receipt, I find the easiest way is to use Apple's receipt verifier, so I moved the receipt data to a file ( receipt-data.der ) on my computer: 解码Apple收据的方法很多 ,我发现最简单的方法是使用Apple的收据验证程序,因此我将收据数据移到了计算机上的文件( receipt-data.der )中:

curl -d "{ \"receipt-data\" : \"$(base64 receipt-data.der)\" }" https://sandbox.itunes.apple.com/verifyReceipt

This showed some interesting new fields: 这显示了一些有趣的新领域:

"organization_display_name": "ACME Bad VPPReceipt Inc."
"receipt_type": "ProductionVPPSandbox"
"expiration_date": "2015-12-10 00:44:22 Etc/GMT"

This is in the sandbox, so results will change when you move to production, but this should be enough to figure out if a given device is vpp or not. 这是在沙箱中,因此结果将在您进入生产环境时发生变化,但这足以确定给定设备是否为vpp。 If you use Apple's receipt verifier, make sure to change the URL to https://buy.itunes.apple.com/verifyReceipt . 如果您使用Apple的收据验证程序,请确保将URL更改为https://buy.itunes.apple.com/verifyReceipt

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我的应用内购买如何满足批量购买计划? - how can my In-App-Purchase cater for volume purchase program? 如何根据Apple ID检查已购买或未使用iOS中的应用程序内购买的用户 - How to check user already purchased or not using In-App Purchase in iOS based on apple ID 我可以通过外部计费绕过Apple的应用购买机制吗? - Can I bypass Apple's in app purchase mechanism by outside billing? 我如何从Apple的应用程序内购买中获得报酬? (iOS iTunesConnect) - How can I get paid for my app's in-app purchase from Apple? (iOS iTunesConnect) 如何分辨Apple In App Purchase是后端的调试测试 - How to tell Apple In App Purchase is a debug testing in backend 通过 Apple 批量购买计划分发自定义 B2B iOS 应用程序? - Distribute Custom B2B iOS app through Apple Volume Purchase Program? 批量购买计划下是否需要更改分发包标识符以分发教育IOS应用程序 - Is there any need to change bundle identifier for distributing education IOS application under Volume Purchase Program 如何在应用购买中对自动续订进行编程以满足Apple指南? - How to program auto-renewing in app purchase to satisfy Apple guidelines? 如何检查我在商家帐户中开发的应用程序的Apple应用程序内购买交易ID? - how to check Apple In-app purchase's transactionIDs for the app i developed in my merchant account? iOS-我可以自定义Apple托管的应用内购买内容吗? - iOS - Can I customise in-app purchase content hosted with Apple?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM