Can't get in-app purchase to work.

Well, I take my hair off of this. I am developing an application that will be free (with ads and some blocked features). An in-app purchase will remove ads and provide full functionality.

So, I set up SKProductsRequest, passing it my product identifier (com.mydomain.Myapp.fullversion) and executed 'start'. This fails and continues to call productsRequest: didReceiveResponse: where the NSLog shows that response.products.count is zero - so the problem!

So, a stupid question.

Q1. When launching my application through Xcode on my test device, does the test device need to have an Internet connection (for example, a wireless connection) or is it enough for the Mac to run it Does Xcode have an Internet connection? (Answer: you need a connection on the test device).

Q2.How can I make it work?

I checked all of the following:

Have you enabled In-App Purchases for your app ID? . On the Provisioning Portal, under app IDs, I have “bundle_seed_id.com.mydomain.Myapp” and “In-App Purchase” enabled.

Have you checked Clear for sale for your product?
In iTunes Connect, I created my purchase in the com.mydomain.Myapp.fullversion application and it is cleared for sale.

Does your .plist Bundle ID project contain your app ID? . Yes, it has the meaning of "com.mydomain.Myapp".

Have you created and installed a new provisioning profile for the new application identifier ?:
Yes I created and installed PP for "com.mydomain.Myapp".

Have you set your project to code using this new training profile ?:
I have only entries in the "Code Signature Identification" section (and not CS rights, CS resource rules path, and other CS Flags). It was configured using automatic profile selection> IPhone Developer and matches me for Myapp, and for Debug> Any SDK and Release> Any IOS SDK.

Do you use the full product identifier when creating SKProductRequest ?:
Yes, I use "com.mydomain.Myapp.fullversion".

Have you waited several hours since adding your product to iTunes Connect ?:
Yes, I waited 24 hours.

Are your bank details active in iTunes Connect ?:
Yes they are.

Have you tried uninstalling the application from the device and reinstalling it ?:
Many times.

Observation here: on the test device, I did not enter “iTunes and App Stores”, and when I launch the application from Xcode on the test device, it did not ask me to log in (I have a test user configured in iTunes Connect and ready to use). So my application starts, calls start with SKProductRequest, but I’m never invited to enter the iTunes and App Store.

Thank you very much in advance. Hope someone can help me with my in-app purchases. Byron

Update 1: Here is some code, although I'm not sure how much this will help. As I said above, it fails in productsRequest: didReceiveResponse: without returning any products.

First I call:

[[MyappIAPHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) { if (success) { NSLog(@"SUCCESS - WE HAVE PRODUCTS"); _products = products; NSLog(@"_products.count = %d", _products.count); } else { if(products == nil) { NSLog(@"FAILED - WE HAVE NO PRODUCTS"); } } }]; 

The code for this looks like this:

 - (void)requestProductsWithCompletionHandler:(RequestProductsCompletionHandler)completionHandler { _completionHandler = [completionHandler copy]; NSLog(@"IAPHelper, requestProductsWithCompletionHandler{}, _productIdentifiers = %@", [_productIdentifiers anyObject]); _productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:_productIdentifiers]; _productsRequest.delegate = self; [_productsRequest start]; } 

The "start" is not interrupted and continues to call productsRequest: didReceiveResponse:

 - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response 

{

 NSLog(@"Loading list of products..."); NSLog(@"iAPHelper, productRequest:didRecieveResponse{}, Products count = %d", response.products.count); 

And as soon as you enter this function, it did not work, since response.products.count is zero.

I just added the following debugging code to productRequest: didRecieveResponse {}

 for (NSString *invalidProductId in response.invalidProductIdentifiers) { NSLog(@"Invalid product id: %@" , invalidProductId); } 

And it states that "com.mydomain.Myapp.fullversion" is invalid.

Update 2: Now this is no joke - still not working!

I followed http://developer.apple.com/library/ios/#technotes/tn2259/_index.html for sure. I thought the problem might be that when I created my purchase in the application, I uploaded a screenshot, but I fixed it by deleting the purchase in the application, re-creating it, ensuring that it is in the “Pending screenshot” state, according to the documentation. I now waited more than 12 hours for a newly created purchase in an application for filtering through Apple servers. I uninstalled the application from my test device. Checked that I left the store on a test device. Re-started the test device. Run Clean in Xcode and restarted Xcode. Run the application from Xcode and guess what? Invalid product id !!!! Please help everyone, I'm losing my mind !!!!!

+4
source share
2 answers

SOLVED PROBLEM

After raising the TSI, an Apple representative finally found my problem.

Looking at my application in iTunes Connect, he claims that he has the package identifier “Myapp”. Whereas the application identifier in the Provisioning Portal, which includes access to the application, was "bundle_seed_id.com.mydomain.Myapp". What was not obvious, or at least to me, was that this app id consists of a Bundle id, which should match the app bundle id in iTunes Connect.

The first application identifier I ever created in the Provisioning Portal was wild. When you start the process of creating a new application, it wants you to enter the Bundle identifier, which you select from the drop-down list, which is populated from the application identifiers in the Provisioning Portal. If you select a Bundle identifier that has a wild-card, it will request a Bundle ID chest identifier in which I would enter “Myapp” and then “Myapp” becomes your Bundle identifier. A bit strange, since I thought it was just a suffix.

Later (several months later), when I decided that I would like to implement an In-App Purchase, I would find that the Wild-Card app IDs cannot be used with push notifications or for in-app purchases. Therefore, I would then create a new application identifier in the Provisioning Portal, following the prompts that say "Recommended practice is to use the reverse domain name style string for the application identifier package identifier part" - therefore, I entered "com.mydomain.Myapp I did not know that the Bundle identifier that I created for the application identifier was supposed to match the identifier of the application package created earlier in iTunes Connect.

Now I created a new application identifier "bundle_seed_id.Myapp" in the Provisioning Portal and voila, my product identifier "com.mydomain.Myapp.fullversion" is no longer invalid and now it works.

+6
source

A1. you need to connect to your test device

A2. post some code

+1
source

All Articles