How to test appStoreReceiptURL on OSX

I developed one app (free app) and uploaded it to the apple store, right now I want to know if the app is installed from the app store or local pkg file. Therefore, I will use the code as shown below:

    NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
    NSData *receiptData = [NSData dataWithContentsOfURL:receiptURL];
    if (!receiptData) {
        [NSException raise:@"MacAppStore Receipt Validation Error" format:@"Failed to fetch the MacAppStore receipt.", nil];
    }

      

When receiptData is nil, then I can know the app is installed from the local pkg file, right? And I also want to test this code without submitting this new change to the Apple Store, is there anyone who can help? Thanks to

+3


source to share





All Articles