Hi Guys,
I am developing IOS purchases on a physical device.
Everything was working fine until I upgrade to IOS 14 version.
Device: Physical iPhone 6
IOS: 14
IT iS NOT RESOLVED YET.
The problem:
Before making a purchase I send to verify the restore purchases with my backend.
I check that the user does not have active subscriptions
If the user does not have active subscriptions, I will send him to buy a subscription
The purchase popup never appears
This happens with users who have already made a purchase before.
I tried removing the call from the restore purchases and it works fine without this one.
RCT_EXPORT_METHOD(getAvailableItems:(RCTPromiseResolveBlock)resolve
									reject:(RCTPromiseRejectBlock)reject) {
		NSLog(@"\n	getAvailableItems \n ");
		[self addPromiseForKey:@"availableItems" resolve:resolve reject:reject];
		[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}
(void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {	////////	 RESTORE
		NSLog(@"\n\n\n	paymentQueueRestoreCompletedTransactionsFinished	\n\n.");
		NSMutableArray* items = [NSMutableArray arrayWithCapacity:queue.transactions.count];
		for(SKPaymentTransaction *transaction in queue.transactions) {
				if(transaction.transactionState == SKPaymentTransactionStateRestored
					 || transaction.transactionState == SKPaymentTransactionStatePurchased) {
						[self getPurchaseData:transaction withBlock:^(NSDictionary *restored) {
								[items addObject:restored];
								[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
						}];
				}
		}
		NSLog(@"\n	paymentQueueRestoreCompletedTransactionsFinished : %@", items);
		[self resolvePromisesForKey:@"availableItems" value:items];
}
(void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {
		NSLog(@"\n	paymentQueueError \n ");
		dispatch_sync(myQueue, ^{
				[self rejectPromisesForKey:@"availableItems" code:[self standardErrorCode:(int)error.code]
													 message:error.localizedDescription error:error];
		});
		NSLog(@"\n\n\n restoreCompletedTransactionsFailedWithError \n\n.");
}
RCT_EXPORT_METHOD(buyProduct:(NSString*)sku
									andDangerouslyFinishTransactionAutomatically:(BOOL)finishAutomatically
									resolve:(RCTPromiseResolveBlock)resolve
									reject:(RCTPromiseRejectBlock)reject) {
		pendingTransactionWithAutoFinish = finishAutomatically;
		SKProduct *product;
		@synchronized (validProducts) {
				for (SKProduct *p in validProducts) {
						if([sku isEqualToString:p.productIdentifier]) {
								product = p;
								break;
						}
				}
		}
		if (product) {
				[self addPromiseForKey:product.productIdentifier resolve:resolve reject:reject];
						
				SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:product];
				[[SKPaymentQueue defaultQueue] addPayment:payment];
		} else {
				if (hasListeners) {
						NSDictionary *err = [NSDictionary dictionaryWithObjectsAndKeys:
																 @"Invalid product ID.", @"debugMessage",
																 @"E_DEVELOPER_ERROR", @"code",
																 @"Invalid product ID.", @"message",
																 sku, @"productId",
																 nil
																 ];
						[self sendEventWithName:@"purchase-error" body:err];
				}
				reject(@"E_DEVELOPER_ERROR", @"Invalid product ID.", nil);
		}
}
It is the library react-native-iap that I am using
Post
Replies
Boosts
Views
Activity
Hi Guys,
Yesterday we tested Restore Purchases and it stop working. When i call restoreCompletedTransactions it does not resolve paymentQueueRestoreCompletedTransactionsFinished.
Real Device Iphone 6
IOS 14.1
Sandbox
When I ty to enter to Manage Prices in AppleStoreConnect. I got the following error:
"There was a problem retrieving the data for this page. Please try again."
Please help!
Hi Guys,
I am developing IOS purchases on a physical device.
Everything was working fine until I upgrade to IOS 14 version.
Device: Physical iPhone 6
IOS: 14
The problem: Before making a purchase I send to verify the restore purchases with my backend
I check that the user does not have active subscriptions
If the user does not have active subscriptions, I will send him to buy a subscription
The purchase popup never appears
This happens with users who have already made a purchase before.
I tried removing the call from the restore purchases and it works fine without this one.
RCT_EXPORT_METHOD(getAvailableItems:(RCTPromiseResolveBlock)resolve
									reject:(RCTPromiseRejectBlock)reject) {
		[self addPromiseForKey:@"availableItems" resolve:resolve reject:reject];
		[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}
(void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {	////////	 RESTORE
		NSLog(@"\n\n\n	paymentQueueRestoreCompletedTransactionsFinished	\n\n.");
		NSMutableArray* items = [NSMutableArray arrayWithCapacity:queue.transactions.count];
		for(SKPaymentTransaction *transaction in queue.transactions) {
				if(transaction.transactionState == SKPaymentTransactionStateRestored
					 || transaction.transactionState == SKPaymentTransactionStatePurchased) {
						[self getPurchaseData:transaction withBlock:^(NSDictionary *restored) {
								[items addObject:restored];
								[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
						}];
				}
		}
		[self resolvePromisesForKey:@"availableItems" value:items];
}
(void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {
		dispatch_sync(myQueue, ^{
				[self rejectPromisesForKey:@"availableItems" code:[self standardErrorCode:(int)error.code]
													 message:error.localizedDescription error:error];
		});
		NSLog(@"\n\n\n restoreCompletedTransactionsFailedWithError \n\n.");
}
RCT_EXPORT_METHOD(buyProduct:(NSString*)sku
									andDangerouslyFinishTransactionAutomatically:(BOOL)finishAutomatically
									resolve:(RCTPromiseResolveBlock)resolve
									reject:(RCTPromiseRejectBlock)reject) {
		pendingTransactionWithAutoFinish = finishAutomatically;
		SKProduct *product;
		@synchronized (validProducts) {
				for (SKProduct *p in validProducts) {
						if([sku isEqualToString:p.productIdentifier]) {
								product = p;
								break;
						}
				}
		}
		if (product) {
				[self addPromiseForKey:product.productIdentifier resolve:resolve reject:reject];
						
				SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:product];
				[[SKPaymentQueue defaultQueue] addPayment:payment];
		} else {
				if (hasListeners) {
						NSDictionary *err = [NSDictionary dictionaryWithObjectsAndKeys:
																 @"Invalid product ID.", @"debugMessage",
																 @"E_DEVELOPER_ERROR", @"code",
																 @"Invalid product ID.", @"message",
																 sku, @"productId",
																 nil
																 ];
						[self sendEventWithName:@"purchase-error" body:err];
				}
				reject(@"E_DEVELOPER_ERROR", @"Invalid product ID.", nil);
		}
}
It is the library react-native-iap that I am using
My problem is the following:
I created an application in XCode and I logged in with an account that is not enrolled in the Apple Developer Program. And the BundleId was automatically registered in that account.
So now that we have the new developer account (Enrolled) it no longer lets me register the same bundleID. Because it tells me an error "cannot be registered to your development team because it is not available. Change your bundle identifier to a unique string to try again.
And look in forums that the only solution is:
Login to Apple Developer with the account that registered that bundleId
Go to certificates
Revoke the certificate
But it is a free account. I do not see the option "Certificates"
Please help!