I'm trying to add in-app purchase to my app, following the techniques described here :
Introduction to In-App Purchases in iOS 6 Tutorial
I've added a product via itunes connect, which has an id set up like this:
com.mycompany.myapp.myproduct1
The bundle id (specified in the p-list and also on the app store) is set up like this:
com.mycompany.myapp
I'm using the helper class from the tutorial, IAHelper, to handle the purchase functionality (relevant code shown below). It also has a subclass which is essentially used to add the id of the in-app product(s) to the IAHelper's array of products ids.
In order to test the code, I created a button labeled "show products" which calls this method:
- (IBAction) showProducts {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productsLoaded:) name:kProductsLoadedNotification object:nil];
Reachability *reach = [Reachability reachabilityForInternetConnection];
NetworkStatus netStatus = [reach currentReachabilityStatus];
if (netStatus == NotReachable) {
NSLog(@"No internet connection!");
} else {
if ([InAppMyAppAPHelper sharedHelper].products == nil) {
// here's where it calls the helper class method to request the products
[[InAppMyAppAPHelper sharedHelper] requestProducts];
self.hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
_hud.labelText = @"Loading vocabulary...";
[self performSelector:@selector(timeout:) withObject:nil afterDelay:30.0];
}
}
}
This is the method to request products from iTunesConnect, called above:
- (void)requestProducts {
self.request = [[[SKProductsRequest alloc] initWithProductIdentifiers:_productIdentifiers] autorelease];
_request.delegate = self;
[_request start];
}
(Note that the variables preceded by "_" refer to the actual variables of the same name sans the underscore per several synthesize statements)
Finally, this is the method (in IAHelper) that gets notified when the response is received:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
NSLog(@"IAHelper, received products results...");
self.products = response.products;
self.request = nil;
// Here's the loop to list the products received
for (id product in _products){
NSLog(@"IAHelper, received product is: %@", product);
}
[[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:_products];
}
In the above, the log statements show the method is called, but the loop to print the received products doesn't list anything.
So it looks as if it's not finding the product in iTunes connect. Yet, I've set up a product there, and the id of the product is the same as the bundle id, plus the product identifier, i.e.
bundle id: com.mycompany.myapp
product id: com.mycompany.myapp.product1
I've checked that several times.
I noticed that iTunes lists the status of the ad-in product as "ready to submit". Is there an additional step I need to make to make it available?
Overall, what am I doing wrong?
If you haven't received an in-app item you bought, try closing and restarting the app or game you're using. Tap Apps or Manage applications (depending on your device, this may be different). Tap the app you used to make your in-app purchase.
Review status On average, 90% of submissions are reviewed in less than 24 hours. You'll be notified by email of status changes. You can also check the review status of your submission in the My Apps section of App Store Connect or on the App Store Connect app for iPhone and iPad.
Make sure you're signed in with the same Apple ID that you used to make the purchase. Make sure in-app purchases are allowed on your device. Restart your device: Restart your iPhone.
You're in the right place to get support with your pending transactions. First, we'd like to say that you can double-check by adding up the pending transactions to verify there's enough money in your account to cover them. Also, remember that purchases can take 1-3 days, sometimes more, to clear with the bank.
I run into the exact similar problem. Here are some steps that needs to be adressed/checked after reading this technical note from Apple:
As mentioned by the official doc there is NO need to submit binaries neither submit screenshot of in-app purchase. I have seen a lot of missleading info about this on various blogs.
After checking you have addressed each point in this list, delete your app and reinstall it.
I was basically missing two things on my side: setting up correctly my contract for ios Paid app and i didn't install the new provisioning profile on my device. May be that was your issue?
Getting no valid products returned in productsRequest:didReceiveResponse is a well known issue. There are many reasons, some given in TN2259 especially FAQ#6. Usually the problem is that the app is not directing itself towards the sandbox. Often that is because the developer did not do these 3 things in order: 1) delete old builds of the app (delete, not overwrite) 2) log out of the app store on the device using the settings app 3) run the app from Xcode on a device (not a simulator) and log into the store using a test user only when asked by the app store.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With