To enable In-App Purchase in my application I did a tutorial which referenced a not up to date VerificationController for the receipt validation.

As a result my app got rejected because of using an unique identifier for iOS5. As I basically like the idea to support iOS5 as well as iOS6 I figured that there might be a solution to get the "Pre iOS 6" code underneath running but I only found this solution, which suggest (in the companion file) just to delete all the "Pre iOS 6" code.

- (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
}

My question would be: how do you match transaction info and receipt for iOS5? Why isn't it in the VerificationController anymore, isn't it important?

Any ideas appreciated, Chris

有帮助吗?

解决方案

See the solution here: https://github.com/MugunthKumar/MKStoreKit/issues/142

You don't need VerificationController (which uses [UIDevice currentDevice].uniqueIdentifier) for MKStoreKit to work fine. I simply deleted the files since the code is never called from the MKStoreManager.

or create your own UDID: https://github.com/MugunthKumar/MKStoreKit/issues/142#issuecomment-17433634

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top