开发者

Current receipt invalid or mismatched ds person id

开发者_运维技巧I am trying to test In-App purchases for MacOS. After entering the test user credentials, the App Store complains: "Current receipt invalid or mismatched ds person id." and the purchase fails.


Some of the many things I tried to get around this problem.


Getting App Store Receipts

UPDATE: Here is Rainer Brockerhoff's comment from the bottom that article. Much more elegant solution.

I don't see the need for all those contortions...

To debug my receipt checking code, I just build, then show the product app in the Finder. Double-click it once and it will exit(173), then you'll get the receipt into the bundle.

Now go back to Xcode and debug the checker. The receipt will stay there until you clean; you can do all that again, or copy the receipt elsewhere and put it back after build - at one point I had the receipt reinserted by a build script.

If you want to test out the archived app, show the product in the Finder, then go up a few folder levels to the "Release" folder, and there'll you see the app - you can double-click it from there.


The long procedure for getting a receipt:

  1. Archive the app
  2. Within Xcode organizer
  3. Select Distribute...
  4. Export as: Mac Installer Package

Finally install it from the commandline like this

sudo installer -store -pkg (path to package including filename) -target /

Now the app should contain a receipt at this path

/Applications/SampleApp.app/Contents/_MASReceipt/receipt


Verification Email

Apple sends an email when you create a Test User within iTunes Connect.

Email subject:

Please verify the contact email address for your Apple ID

My mail ended up in my spam folder, so I never saw it. Thus never got verified the Test User Account.


Check Status

Within iTunes Connect under Manage Your Apps > SampleApp > Manage In-App Purchases

Here the status should say: Ready to Submit

If it doesn't, then you may need to upload a screenshot.


I will answer my own question. I watched the video called "In-App Purchase for iOS and Mac OS X" on http://developer.apple.com/videos/wwdc/2011/.

The key part was regarding downloading the app receipt at launch. The code to include in the App Delegate was something like:

- (void) applicationWillFinishLaunching:(NSNotification *)notification
{
    if(![[NSFileManager defaultManager] fileExistsAtPath:[[[NSBundle mainBundle] appStoreReceiptURL] path]]) {
        NSLog(@"to get sandbox receipt, the app must be launched from outside xcode");
        //exit(173);
    }
}


i myself was very much in trouble in order to integrate In-App Purchase in Mac OS X.

I googled a lot but nothing came with the solution. Finally, apple developers came to rescue. the basically told the reason in wwdc 2012 that there was a bug in MAC OS X (version 10.7.2) due to which one was not able to receive the receipt.

This bug has been solved in the latest version ie MAC OS X (version 10.7.4)

i simply upgraded my OS and was able to get the receipt. So friends who so ever get the problem "Current receipt invalid or mismatched ds person id." simply upgrade the OS to 10.7.4 and the apso write down the following code in your app delegate "applicationDidFinishLaunching" method-

if(![[NSFileManager defaultManager] fileExistsAtPath:[[[NSBundle mainBundle] appStoreReceiptURL] path]]) {
    NSLog(@"to get sandbox receipt, the app must be launched from outside xcode");
    exit(173);
}

and run ur code for first time outside the XCode. then after receiving the recipt u can debug again from the XCode.

Every time you clean the build u have to run ur app outside the XCode.


Is the receipt for the application that you run was also for the same test user as the one that you try to perform In-App purchase for?

If your debug version runs without a proper receipt (from the same test user) I doubt the In-App purchase will work. Don't use the sample receipt when you want to test In-App purchase, use a real one from the same test user as you're going to buy the In-App product.

I have succeeded performing In-App purchase in my own Mac App (though it's still not in the store) so if you have more questions, fire away.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜