为了在我的应用程序中启用应用内购买,我做了一个教程,其中引用了一个不是最新的 VerificationController 来验证收据。
结果,我的应用程序因为使用 iOS5 的唯一标识符而被拒绝。因为我基本上喜欢支持 iOS5 和 iOS6 的想法,所以我认为可能有一个解决方案可以让下面的“Pre iOS 6”代码运行,但我只找到了这个解决方案,它建议(在配套文件中)只是删除所有“Pre iOS 6”代码。
- (BOOL)doesTransactionInfoMatchReceipt:(NSString*) receiptString
{
// some code above
if ([[UIDevice currentDevice] respondsToSelector:NSSelectorFromString(@"identifierForVendor")]) // iOS 6?
{
#if IS_IOS6_AWARE
// iOS 6 (or later)
NSString *localIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
NSString *purchaseInfoUniqueVendorId = [purchaseInfoFromTransaction objectForKey:@"unique-vendor-identifier"];
NSString *verifiedReceiptVendorIdentifier = [verifiedReceiptReceiptDictionary objectForKey:@"unique_vendor_identifier"];
if(verifiedReceiptVendorIdentifier)
{
if (![purchaseInfoUniqueVendorId isEqualToString:verifiedReceiptVendorIdentifier]
|| ![purchaseInfoUniqueVendorId isEqualToString:localIdentifier])
{
// Comment this line out to test in the Simulator.
failCount++;
}
}
#endif
} else {
// Pre iOS 6 - this part is missing now
NSString *localIdentifier = [UIDevice currentDevice].uniqueIdentifier;
NSString *purchaseInfoUniqueId = [purchaseInfoFromTransaction objectForKey:@"unique-identifier"];
if (![purchaseInfoUniqueId isEqualToString:verifiedReceiptUniqueIdentifier]
|| ![purchaseInfoUniqueId isEqualToString:localIdentifier])
{
// Comment this line out to test in the Simulator.
failCount++;
}
}
// more code
}
我的问题是:你如何匹配 iOS5 的交易信息和收据?为什么它不再在 VerificationController 中了,这不重要吗?
任何想法表示赞赏,克里斯