In App Purchase SKProductsRequest does not work when the application is already installed on the device

I'm having problems testing the app purchase feature. If I reinstall the application on a device that already installed the application with the previous version, SKProductsRequest returns a response with only an object to invalidProductIdentifiers. If I remove the application from the device and then reinstall the new version, SKProductsRequest works fine.

Any ideas?

Thanks in advance.

- (void)requestProductData:(NSString *)aFeatureID { SLLog(@"Products Request For: %@", aFeatureID); SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:aFeatureID]]; request.delegate = self; [request start]; } - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { if ([response.products count] > 0) { [self.purchasableObjects addObjectsFromArray:response.products]; #ifndef NDEBUG for(int i=0;i<[self.purchasableObjects count];i++) { SKProduct *product = [self.purchasableObjects objectAtIndex:i]; SLLog(@"Feature: %@, Cost: %f, ID: %@",[product localizedTitle], [[product price] doubleValue], [product productIdentifier]); } for(NSString *invalidProduct in response.invalidProductIdentifiers) SLLog(@"Problem in iTunes connect configuration for product: %@", invalidProduct); #endif isProductsAvailable = YES; } else if ([response.invalidProductIdentifiers count] > 0){ SLLog(@"MKStoreManager-productsRequest empty results: %@", [response.invalidProductIdentifiers objectAtIndex:0]); } if([_delegate respondsToSelector:@selector(productFetchComplete)]) [_delegate productFetchComplete]; [request autorelease]; } 
+4
source share
1 answer

This is what someone told me on Cocoa -dev@lists.apple.com :

Are you connecting to a sandbox environment or production?

I believe that you can only connect to the Sandbox when starting through Xcode and if the application is β€œupdated” from the App Store version, it will not start the Sandbox. At least, this is a tiny bit of Iood voodoo I witnessed ... This means that it can stop being true at any time, because the IAP setup is one sacrificial lamb from magic.

I am not 100% sure because I have not tested it yet, but I will let you know as soon as I do it.

+6
source

Source: https://habr.com/ru/post/1345734/


All Articles