views:

1238

answers:

4

Hello, I am trying to test In App Purchases on my iPhone and running into a problem where the product IDs I request information for end up being returned to me as invalid product IDs in the "didRecieveResponse" method.

I have:

  • Created an in store product associated with this app. It's bundle ID matches everything else. It has been cleared for sale and approved by the developer.
  • Made sure my new provisioning profile has in store app purchases enabled and it has the full app name: "com.domain.appname"
  • Made sure this is the provisioning profile being used to sign the app to my iPhone.
  • Made sure that "com.domain.appname" is the app ID used to build the provisioning profile.
  • Made sure that "com.domain.appname" is used in my plist file as the bundle identifier.

Everything seems to be in place, however I still get my products returned to me as invalid IDs.

This is the code I am using:


- (void)requestProductData {
   SKProductRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObject: @"com.domain.appname.productid"]];
   request.delegate = self;
   [request start];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
   NSArray *myProducts = response.products;
   NSArray *myInvalidProducts = response.invalidProductIdentifiers;

   for(int i = 1; i < myInvalidProducts.count; ++i)
   {
      std::cout <<"invalid product id = " << [[myInvalidProducts objectAtIndex:i] UTF8String] << std::endl;
   }

   for(int i = 0; i  < myProducts.count; ++i)
   {
      SKProduct * myProduct = [myProducts objectAtIndex:i];
      std::cout << "Product Info:"  << std::endl;
      std::cout << "\tlocalizedTitle         = "  << [[myProduct localizedTitle] UTF8String]  << std::endl;
      std::cout << "\tlocalizedDescription   = "  << [[myProduct localizedDescription] UTF8String]  << std::endl;
      std::cout << "\tproductIdentifier      = "  << [[myProduct productIdentifier] UTF8String]  << std::endl;
      std::cout << "\tprice                  = "  << [[myProduct price] doubleValue]  << std::endl;
      std::cout << "\tpriceLocale            = "  << [myProduct priceLocale]  << std::endl;
   }

   [request autorelease];
}

All my product IDs show up in the invalid printouts and none of them show up in the "Product Info:" printouts.

Any suggestions would be greatly appreciated...

P.S. Yes, this is built as Objective-c/c++.

A: 

Hi, same problem here. I am trying to solve it since 2 days but failed. My application yet showing that my requesting product are invalid?

I am not clear what should be the 'product identifer'? so far i know it would be same as the 'product Id' which i have declared in itunes connect

need a example.

plz plz plz

faisal
Your "answer" is not an answer... but I hope we both get it figured out. Keep checking back here, and if you get it figured out, please share the wealth :)
EToreo
ditto. I could use this (3 months later...)
Dave
A: 

OK, so after doing everything I could possibly think of and reading every forum out there, here is what worked:

Redo EVERYHING.

  1. Remove ALL your provisioning profiles from the Xcode Organizer.
  2. Close Xcode.
  3. Create a New App ID.
  4. Create a new Provisioning profile with the new App ID.
  5. Create a new Distribution Provisioning profile with the new App ID.
  6. Create a new App in iTunes Connect
  7. Start Xcode, install your two new provisioning profiles. Update yoru bundle ID to match. Also make sure your id strings that the app requests are updated to reflect your bundle id.
  8. Build your project in Distribution mode with the new Distribution Provisioning profile.
  9. Upload your new binary. (Leave it un-rejected)
  10. Set up your test in-app purchase.
  11. Build your project in Debug mode with the new Provisioning profile.
  12. Test request.

This is what it took to get my store working. My best guess is that the Apple back end servers get screwed up sometimes and you just need to start from scratch.

Hope this helps everyone!

EToreo
were you able to create a new app with the same name as before?
psychotik
A: 

Redo EVERYHING.

  1. Remove ALL your provisioning profiles from the Xcode Organizer
  2. Close Xcode.
  3. Create a New App ID.
  4. Create a new Provisioning profile with the new App ID.
  5. Create a new Distribution Provisioning profile with the new App ID.
  6. Create a new App in iTunes Connect
  7. Start Xcode, install your two new provisioning profiles. Update yoru bundle ID to match. 8. Also make sure your id strings that the app requests are updated to reflect your bundle id.
  8. Build your project in Distribution mode with the new Distribution Provisioning profile.
  9. Upload your new binary. (Leave it un-rejected)
  10. Set up your test in-app purchase.
  11. Build your project in Debug mode with the new Provisioning profile. Test request.

Following this procedure My in app purchase is now working.

Thanks Man With regards

hafiz

Hafizur Rahman
Haha, thanks. Its weird that you copied my entire procedure in your response, though. Could your "answer" just have been a comment?
EToreo
+1  A: 

I tried everything suggested in the Apple forums and here, and still couldn't get it to work. Found the solution - your app needs to be transferred by Xcode for the sandbox to be enabled.

Obvious, right? Well, if you are working with an update to an existing account, the device will still treat it as an App Store-installed app.

Delete it, then transfer it again. It should work now :)

Hector Ramos