问题
We have an App that queries StoreKit for product details like normal (you can disregard that it's a Xamarin App, it shouldn't make a difference unless there's a bug in 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 );
}
What happens is:
- In the Sandbox/Test environment we can query product ids just fine and receive proper responses, on iOS 7 and iOS8 devices
- The App passed review, we're already successfully selling items, so it's working for some users.
- Yet, we have customers reporting that they are unable to see anything in our In App Store. They all have in common that they're running iOS 7 devices. We can reproduce the issue - with the version released on the App Store on the console we see the output "Invalid product id" for each identifier we pass into the
SKProductRequest
. The identifiers match exactly what we specified in code.
It appears this only happens on iOS 7 devices, in the live AppStore environment. I assume they have broken In App Purchases on iOS 7 with an iTunes update or whatever. It's really weird that the Sandbox environment doesn't show the issue. We tested on multiple devices and multiple iTunes Accounts, with clean installs of the App. Customers are having these problems too.
I have already worked with Apple Developer Technical Support and iTunes provider support and their unable/unwilling to diagnose the issue on their end with the engineering team. Thus asking this question here to see whether anyone else is experiencing the same issues or would be able to check with their App. We've already waited more than 24 hours for a "product refresh" that was supposed to fix the issue but it didn't.
Can anyone that has an App featuring In App Purchases test whether the live App Store version still works on iOS7?
Note: It's been like that for more than 72 hours, suggesting it's not a temporary fluke like in:
- iOS In App Purchase - "Invalid Product ID" in release, NOT development version
- In-App-Purchase invalid product id only on release version
We have since released 2 updates to the App to the AppStore, but none of them resolved the problem. Works great on iOS8, invalidProductIdentifiers on iOS7.
This is the console output that we get from our App (slightly amended the logging). What could be a hint at something going wrong is the TASK-ASSERT
error, but I couldn't find any info on that one.
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
We filed a support DTS incident three days ago, and have finally heard back. They agree with us that it appears to be an internal issue in the iTC web service that handles the InApp purchases. I'll keep this thread up to date.
回答1:
Good news - Apple finally figured out what the cause of the issue. It appears that Xamarin.iOS started adding an iTunesMetadata.plist
file to the App bundle during the build process (even though we're not building IPAs and deploy via xcode archives).
Quoting our iOS support engineer:
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.
As a temporary workaround, I've patched out the "_CompileITunesMetadata" msbuild task to prevent generation of an 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>
Our iOS support engineer indicated to me that iTunesConnect may build in validation routines to prevent/reject App submissions that contain a rogue iTunesMetadata.plist
, so that hopefully others won't be hit by this weird behavior.
来源:https://stackoverflow.com/questions/28849100/storekit-returns-invalid-product-identifiers-only-on-the-real-app-store-only