Mac App Store Receipt Validation Code?

前端 未结 13 1732
广开言路
广开言路 2020-12-07 09:04

Wondering if anyone has a tutorial or working code for the new Mac App Store\'s receipt validation? About the only references I\'ve been able to find so far are Apple\'s st

13条回答
  •  孤街浪徒
    2020-12-07 09:11

    In order to validate against the real receipt after testing, change this line of code in your main.m file:

    if (!validateReceiptAtPath(@"~/Desktop/receipt"))
    

    to

    #ifdef USE_SAMPLE_RECEIPT   // defined for debug version
        NSString *pathToReceipt = @"~/Desktop/receipt";
    #else
        NSString *pathToReceipt = [[[NSBundle mainBundle] bundlePath]
            stringByAppendingPathComponent:@"Contents/_MASReceipt/receipt"];
    #endif  
        if (!validateReceiptAtPath(pathToReceipt))
            exit(173); //receipt did not validate
    

    and in your compiler settings, "Other C Flags" for your Debug Configuration should include -DUSE_SAMPLE_RECEIPT

    courtesy http://jesusagora.org/groups/futurebasic/0::53562:get:1read.html

提交回复
热议问题