StoreKit返回无效的产品标识符 – 仅在真正的App Store上,仅在iOS7上

我们有一个应用程序可以查询StoreKit以获取正常的产品详细信息(您可以忽略它是一个Xamarin应用程序,除非Xamarin中存在错误,否则它应该没有区别):

        var request = new SKProductsRequest( new NSSet( ... ) );
        _runningRequests.Add( request );
        request.ReceivedResponse += HandleReceivedResponse;
        request.RequestFailed += HandleRequestFailed;
        request.RequestFinished += HandleRequestFinnished;
        request.Start();

    // ....

    void HandleReceivedResponse( object sender, SKProductsRequestResponseEventArgs e )
    {
        ViewModel.IsProcessing = false;

        foreach (var item in e.Response.InvalidProducts)
            Console.WriteLine( "Invalid product: " + item );

        var products = e.Response.Products.Select( x => new InAppProductViewModel( x.LocalizedTitle, x.ProductIdentifier, x.LocalizedDescription, LocalizedPrice( x ), IsPurchased( x ), () => Purchase( x ) ) );
        var vms = products.ToList();

        ViewModel.UpdateProducts( vms );
    }

会发生什么:

>在Sandbox / Test环境中,我们可以在iOS 7和iOS8设备上查询产品ID并获得正确的响应
>应用程序通过审核,我们已经成功销售商品,因此它适用于一些用户.
>然而,我们有客户报告他们无法在我们的In App Store中看到任何内容.他们都有共同点,他们正在运行iOS 7设备.我们可以重现这个问题 – 在控制台上App Store上发布的版本中,我们看到输入“无效产品ID”的每个标识符都会传递给SKProductRequest.标识符与我们在代码中指定的完全匹配.

看起来这只发生在iOS 7设备上,在实时AppStore环境中.我假设他们已经在iOS 7上通过iTunes更新或其他方式打破了应用内购买.沙盒环境没有显示问题,这真的很奇怪.我们在多个设备和多个iTunes帐户上进行了测试,并对应用程序进行了全新安装.客户也遇到了这些问题.

我已经与Apple开发人员技术支持和iTunes提供商支持合作,他们无法/不愿意与工程团队一起诊断问题.因此,在这里提出这个问题,看看是否有其他人遇到了同样的问题,或者能够检查他们的应用程序.我们已经等了超过24小时的“产品更新”,本来应该解决这个问题,但事实并非如此.

任何拥有In App Purchases应用程序的人都可以测试实时App Store版本是否仍适用于iOS7?

注意:超过72小时就是这样,这表明它不是像以下那样的临时侥幸:

> iOS In App Purchase – “Invalid Product ID” in release, NOT development version
> In-App-Purchase invalid product id only on release version

我们已经向AppStore发布了2个应用程序更新,但没有一个解决了这个问题.适用于iOS7上的iOS8,iOS7上的invalidProductIdentifiers.

这是我们从App获得的控制台输出(略微修改了日志记录).什么可能是出错的提示是TASK-ASSERT错误,但我找不到任何关于那个的信息.

Mar 10 08:08:28 iDevPad01 itunesstored[832] <Error>: TASK-ASSERT: cfurlcache - ProcessCacheTask - FAILED to get task-assertion, going commando with 1 items to process.
Mar 10 08:08:28 iDevPad01 RowingInMotionMobileBoatAppiOSSolo[855] <Warning>: Received SKProductResponse, debugdescription: <SKProductsResponse: 0x1776d950>
Mar 10 08:08:28 iDevPad01 RowingInMotionMobileBoatAppiOSSolo[855] <Warning>: Received SKProductResponse, description: <SKProductsResponse: 0x1776d950>
Mar 10 08:08:28 iDevPad01 RowingInMotionMobileBoatAppiOSSolo[855] <Warning>: Received SKProductResponse, products: 0
Mar 10 08:08:28 iDevPad01 RowingInMotionMobileBoatAppiOSSolo[855] <Warning>: Invalid product: coach
Mar 10 08:08:28 iDevPad01 RowingInMotionMobileBoatAppiOSSolo[855] <Warning>: Invalid product: boat
Mar 10 08:08:28 iDevPad01 RowingInMotionMobileBoatAppiOSSolo[855] <Warning>: Invalid product: com.rowinginmotion.mobile.boatapp.ios.solo.boat
Mar 10 08:08:28 iDevPad01 RowingInMotionMobileBoatAppiOSSolo[855] <Warning>: Invalid product: com.rowinginmotion.mobile.boatapp.ios.solo.coach

我们三天前提交了支持DTS事件,并终于收到了回复.他们同意我们的看法,它似乎是处理InApp购买的iTC网络服务中的内部问题.我会保持这个帖子最新.

最佳答案 好消息 – 苹果终于找出了问题的原因.看来Xamarin.iOS在构建过程中开始向App捆绑包添加一个iTunesMetadata.plist文件(即使我们没有构建IPA并通过xcode存档进行部署).

引用我们的iOS支持工程师:

The issue appears to be that in the deliverable asset which you uploaded to iTunesConnect, there is a “rogue iTunesMetadata.plist” which is not present in other in app purchase apps that do work under iOS 6/7. The issue here is that there is the same file that is built into the app when the app gets installed from the Store to the device. Because this file is present in the app bundle already, the one the StoreKit installs isn’t used. The reason this is a problem is that the iTunesMetaData.plist is missing the 2 field values that are normally included in the fetchSoftwareAddOns URL request that is generated when the SKProductsRequest is called.

作为临时解决方法,我修补了“_CompileITunesMetadata”msbuild任务,以防止生成iTunesMetadata.plist

  <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
  <!-- NOP out CompileITunesMetadata task, which creates a rogue metadata plist file that can break In App Purchases on iOS7 -->
  <Target Name="_CompileITunesMetadata" DependsOnTargets="_DetectSdkLocations;_DetectAppManifest;_GenerateBundleName;_CompileAppManifest">
     <Message Text="Skipping CompileITunesMetadata task, which creates a rogue metadata plist file that can break In App Purchases on iOS7" />
  </Target>

我们的iOS支持工程师告诉我,iTunesConnect可以构建验证例程来防止/拒绝包含恶意iTunesMetadata.plist的App提交,以便希望其他人不会被这种奇怪的行为所击中.

点赞