简体   繁体   English

在其他Mac上的沙箱中测试Mac Appstore的IAP

[英]Test IAP for Mac Appstore in sandbox on other Mac

I am in the process of adding IAP to my Mac application distributed on the Mac App Store. 我正在将IAP添加到在Mac App Store上分发的Mac应用程序中。 It seems to be working fine locally on my Mac inside/outside XCode but for some reason it does not work on other Mac computers with different behaviour (SIGKILL or does not download the App Store Receipt). 在我的Mac内部XCode外部/外部,它似乎可以正常工作,但是由于某些原因,它不能在其他行为不同的Mac计算机上运行(SIGKILL或未下载App Store收据)。

Here is the code I use to ensure the App Store receipt is present or download it properly: 这是我用来确保存在App Store收据或正确下载收据的代码:

void EnsureAppstoreReceipt()
{
  // TODO: Note: In OS X, if the appStoreReceiptURL method is not available (on older systems), you can fall back to a hardcoded path.
  // The receipt’s path would be /Contents/_MASReceipt/receipt inside the app bundle.
  NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
  NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
  if(!receipt)
  {
    // Validation fails
    qDebug() << "No AppStore receipt found. Exiting with 173 to force OSX to generate one in " << QString::fromNSString(receiptURL.absoluteString);
    exit(173);
  }
}

I Archive the application in XCode and then choose Distribute and then Application . 我在XCode中Archive应用程序,然后选择Distribute ,然后选择Application If I chose Don't resign then it does not download the App Store receipt even on my computer. 如果我选择Don't resign那么即使在我的计算机上,它也不会下载App Store收据。 But if I chose the "Mac Appstore Distribution" identity or the "Mac Development" profile then it properly loads the receipt on my development Mac but it does not work on other computer. 但是,如果我选择了“ Mac Appstore发行”标识或“ Mac开发”配置文件,则它将收据正确加载到我的开发Mac上,但在其他计算机上不起作用。 It starts the app and always exit with the code 173 and nothing else. 它会启动该应用程序,并始终以代码173退出,仅此而已。

Is it possible to test IAP in sandbox on a Mac where the application has not been built? 是否可以在尚未构建应用程序的Mac上的沙箱中测试IAP? And if so what am I missing here? 如果是这样,我在这里想念什么?

I finally found a way to do this based on a few tutorials like this one . 我终于根据像这样的一些教程找到了一种方法。 I had to create a new provisioning profile to deploy to other Macs and for this provisionning profile I had to add each Mac machine on which I want to test my app with the "Add a device" on Certificates, Identifiers & Profiles . 我必须创建一个新的配置文件才能部署到其他Mac,对于该配置文件,我必须使用“ 证书,标识符和配置文件 ”上的“添加设备”添加要在其上测试我的应用程序的每台Mac计算机。

Then I had to refresh the list of signing identities in XCode in Preferences => Account and had access to the new provisioning profile. 然后,我必须在Preferences => Account中的XCode中刷新签名身份的列表,并可以访问新的配置文件。 Then I Archive , Distribute my build and export as an Application that I sign with the given provisioning profile and then the App properly launches with sandbox for the AppStore on other Mac computers. 然后,我ArchiveDistribute我的构建并将其导出,并作为我使用给定的配置文件签名的Application Distribute ,然后该应用程序随沙箱正常启动,以在其他Mac计算机上用于AppStore。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM