如何在OSX中测试appStoreReceiptURL

时间:2015-05-28 06:44:59

标签: objective-c macos

我开发了一个应用程序(免费应用程序)并将其上传到Apple商店,现在我想知道该应用程序是从app store还是本地pkg文件安装的。所以我将使用如下代码:

    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];
    }

当receiptData为nil时,我可以知道应用程序是从本地pkg文件安装的,是吗?而且我也想验证这段代码而不向Apple商店提交这个新的更改,有没有人可以帮忙? 感谢

0 个答案:

没有答案