Still getting invalid product identifiers... iOS - ios

I keep getting invalid product identifiers as a return from in app purchase product requests.
I've checked the following:
Checked provisioning profiles, deleted and re-made several times...
Checked product identifiers against products in itunesconnect (uk.co.companyname.appname.product_name).
Deleted app and provisions from phone and re installed.
Logged out of app store on phone.
Checked my code signing (signed as iPhone Developer (with uk.co.companyname.appname as identifier)
Made sure app identifier is in info.plist correctly.
Submitted and rejected app binary.
Running on phone, not simulator.
This is my code for fetching products:
- (void)loadProducts
{
NSSet *productIdentifiers = [NSSet setWithObjects:uk.co.companyname.appname.product_name, uk.co.companyname.appname.product_name2, uk.co.companyname.appname.product_name3, nil];
for(NSString *pk in productIdentifiers) NSLog(#"%#", pk);
SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
productsRequest.delegate = self;
[productsRequest start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSLog(#"products: %d", [response.products count]);
NSLog(#"invalidProductIdentifiers: %d", [response.invalidProductIdentifiers count]);
}
and I get:
products: 0
invalidProductIdentifiers: 9

Related

Empty Auto-Renewing iOS In-App purchases from SKProductsRequest initWithProductIdentifiers

I've made an iOS in-app Auto-Renewable Subscription, now I'm trying to allow users to purchase it in a React-Native app.
I've found react-native-in-app-utils, but can't seem to even load my products. I have 3 "products" (auto-renewable subscriptions) in iTunes connect, but trying to load them with:
var products = [
'com.xxxx.app.monthly',
'com.xxxx.app.6months',
'com.xxxx.app.year',
];
InAppUtils.loadProducts(products, (error, products) => {
console.log('products:', products);
});
just logs "products: []".
Digging a little deeper, I've added some additional logging to the objective-c code doing the querying, and it looks like:
NSLog(#"loading products %#", productIdentifiers);
if([SKPaymentQueue canMakePayments]){
SKProductsRequest *productsRequest = [[SKProductsRequest alloc]
initWithProductIdentifiers:[NSSet setWithArray:productIdentifiers]];
productsRequest.delegate = self;
_callbacks[RCTKeyForInstance(productsRequest)] = callback;
[productsRequest start];
} else {
callback(#[#"not_available"]);
}
Then in the callback:
NSLog(#"products response %#", response.products);
products = [NSMutableArray arrayWithArray:response.products];
NSMutableArray *productsArrayForJS = [NSMutableArray array];
for(SKProduct *item in response.products) {
NSDictionary *product = #{
...
This will log "loading products" with my product ids, as expected. But then "products response ()"... empty response.
Those products are listed in iTunes connect as "Ready to Submit". And they've been added to the app info under In-App Purchases. What gives? Why aren't the products showing up?
Looks like it was an administrative issue, not a technical one. Project Manager hadn't put through the paid app agreement.

In App purchased product not found but already setup on itune connect year 2017

Hello guys I am having issue on in-app purchased' here what I have done.
First I add my product id in ituneconnect example product id "com.myweb.myappname.product1" and my bundle Identifier in my ios project is "com.myweb.myappname".
The status of my product ID is Ready to Submit but my problem is I cannot submit it because' the Save and Submit for Review button is disabled.
How to resolved this?
I used this code to tes in app purchased code but the result is always "NO product Found..".
//my bundle Identifier = com.myweb.myappname
NSURL *url = [[NSBundle mainBundle] URLForResource:#"product_ids"
withExtension:#"plist"];
NSArray *productIdentifiers = [NSArray arrayWithContentsOfURL:url];
NSString *myfirstrpodcuct = [productIdentifiers objectAtIndex:0];
NSLog(#"myfirstrpodcuct = %#",myfirstrpodcuct); //this display my product id com.myweb.myappname.product1
if([SKPaymentQueue canMakePayments]) {
SKProductsRequest *request = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObjects:myfirstrpodcuct, nil]];
request.delegate = self;
[request start];
} else {
NSLog(#"Cannot used inApp Purchased.");
}
- (void)productsRequest:(SKProductsRequest *)request
didReceiveResponse:(SKProductsResponse *)response
{
self.products = response.products;
if(response.products.count != 0){
NSLog(#"Product Found..");
} else {
NSLog(#"NO product Found..");
exit(0);
}
for (NSString *invalidIdentifier in response.invalidProductIdentifiers) {
// Handle any invalid product identifiers.
NSLog(#"Handle any invalid product identifiers");
}
NSLog(#"displayStoreUI");
// [self displayStoreUI]; // Custom method
}
I also tried to archived the project and submit the binary to ituneconnect. Then I used testflight to test the app but still the product not found.. any idea?

How to test In-app purchase in Sandbox mode iOS?

Am new to In-app purchase integration in iOS application. I have done the coding in the project level and I have created a Sandbox user in iTunes Connect. I read many tutorials and Apple Document to test the In-App purchase in DEV mode.
As per the document I have removed the APPLE ID from iPad Settings and launched the app from Xcode. But, I didn't received the Account Alert from the app. Also, my products are returning empty in SKProductRequest delegate method didReceiveResponse. I have posted my code for your reference. Can you please help me on this? Am working since last two days. Please help me. Thanks in advance.
- (void) getAvailProducts
{
NSLog(#"Fetching Available Products");
NSSet *productIdentifiers = [NSSet setWithObjects:#"com.test.testios.monthly", #"com.test.testios.yearly" ,nil];
self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
self.productsRequest.delegate = self;
[self.productsRequest start];
}
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
//SKProduct *validProduct = nil;
DebugLog(#"\n Products: %#", response.products);
NSUInteger count = [response.products count];
NSLog(#"Request Count: %lu", (unsigned long)count);
if (count > 0)
{
self.validatedProducts = response.products;
DebugLog(#“\n Products: %#", response.products);
self.validationCheck = TRUE;
[[SKPaymentQueue defaultQueue] removeTransactionObserver:self];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
// Check subscription
}
else
{
// No products found….
}
}
Also, I tried with "monthly and yearly" instead of "com.test.testios.monthly and com.test.testios.yearly". But, no results.
Edit: Am getting the mentioned ProductIds are invalid in the following code,
for (NSString *invalidProductId in response.invalidProductIdentifiers)
{
NSLog(#"Invalid product id: %#" , invalidProductId);
}
Thank you all.
Fixed the issue and tested the In-App purchase in Sandbox environment. Following items fixed my issue,
1. iTunes Agreement was not accepted.
2. Tax and Payment details was not added.
3. Added correct Product Identifier in project.

Issue with InApp purchase in Sandbox mode: SKProductsRequest delegate returns inconsistent response

When requesting for in-app auto renewable subscription products from apple, I sometimes get valid products but most of the times I get invalidProductIdentifiers in SKProductsResponse object. I wrote a small piece of code to verify this inconsistency in response:
-(void)viewDidAppear:(BOOL)animated{
[self getProductsFromApple];
}
-(void)getProductsFromApple{
SKProductsRequest *_productRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:#"2"]];
[_productRequest setDelegate:self];
[_productRequest start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
NSLog(#"Invalid %#", response.invalidProductIdentifiers);
NSLog(#"Valid %#", response.products);
if (response.invalidProductIdentifiers && [response.invalidProductIdentifiers isKindOfClass:[NSArray class]] && response.invalidProductIdentifiers.count) {
[self getProductsFromApple];
}
}
This sometimes succeeds after n calls to apple server.Our team has escalated the issue to apple, we are waiting for there response.
Has anyone faced this issue, kindly suggest how you were able to test in-apps payment ?

In-App Purchase Product Request Method Needs Two Calls

I currently have created a series of methods that call and return In-App Purchase products that I have created. I can call the SKProductRequest without issue, I can even purchase the item and receive a successful purchase notification (SKPaymentTransactionStatePurchased).
The issue is that for whatever reason, when I initially run the app, I have to call the following methods 2 times in order to receive a non-null response from Apple:
/// In app purchases
- (IBAction)BuyProduct:(id)sender {
if ([SKPaymentQueue canMakePayments]) {
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:_productID]];
request.delegate = self;
[request start];
} else {
NSLog(#"Please enable In App Purchasing in your settings");
}
}
#pragma mark _
#pragma mark SKProductsRequestDelegate
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
NSArray *products = response.products;
if (products.count != 0) {
NSLog(#"Products available: %#", _product.localizedTitle);
_product = products[0];
} else {
NSLog(#"Products not found.");
}
products = response.invalidProductIdentifiers;
for (SKProduct *product in products) {
NSLog(#"Product not found: %#", product);
}
}
Every time, the first time I call the BuyProduct IBAction i receive this:
(excuse the dashes - simply clearing my personal info!)
---------- --.07.55.823 -------[2474:827710] Products available: (null)
Then the second time and onwards that I call the same IBAction button, I receive the IAP name correctly,
---------- --.08.03.142 -------[2474:827710] Products available: TEST IAP
---------- --.08.04.455 -------[2474:827710] Products available: TEST IAP
SO, I am just trying to figure out why I need to call these methods 2 times in order for Apple (or my code) to successfully return my IAP product name. If anyone could help me out I would greatly appreciate it!

Resources