1.2.1
IOS
Return the subscription details.
Return E_DEVELOPER_ERROR error as below
Product Error: sl_monthlysub{"framesToPop":1,"code":"E_DEVELOPER_ERROR","nativeStackIOS":["0 SmartLottery 0x00000001070aba36 RCTJSErrorFromCodeMessageAndNSError + 134","1 SmartLottery 0x000000010703a5a3 __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.218 + 179","2 SmartLottery 0x0000000107276a89 -[RNIapIos buyProduct:resolve:reject:] + 1177","3 CoreFoundation 0x0000000109a07ccc __invoking___ + 140","4 CoreFoundation 0x0000000109a07b84 -[NSInvocation invoke] + 308","5 CoreFoundation 0x0000000109a208d6 -[NSInvocation invokeWithTarget:] + 54","6 SmartLottery 0x000000010703c5ac -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2796","7 SmartLottery 0x00000001070f2022 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 786","8 SmartLottery 0x00000001070f1b4f _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127","9 SmartLottery 0x00000001070f1ac9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25","10 libdispatch.dylib 0x000000010f7ab6cb _dispatch_call_block_and_release + 12","11 libdispatch.dylib 0x000000010f7ac709 _dispatch_client_callout + 8","12 libdispatch.dylib 0x000000010f7b4142 _dispatch_queue_serial_drain + 735","13 libdispatch.dylib 0x000000010f7b493f _dispatch_queue_invoke + 321","14 libdispatch.dylib 0x000000010f7b10fa _dispatch_queue_override_invoke + 477","15 libdispatch.dylib 0x000000010f7b6c88 _dispatch_root_queue_drain + 473","16 libdispatch.dylib 0x000000010f7b6a51 _dispatch_worker_thread3 + 119","17 libsystem_pthread.dylib 0x000000010fccf169 _pthread_wqthread + 1387","18 libsystem_pthread.dylib 0x000000010fccebe9 start_wqthread + 13"],"domain":"RCTErrorDomain","userInfo":null}
console.warn @ blob:http://localhosā¦-e33a40325e0f:53698
(anonymous) @ blob:http://localhosā¦e33a40325e0f:156937
tryCallOne @ blob:http://localhosā¦1-e33a40325e0f:3515
(anonymous) @ blob:http://localhosā¦1-e33a40325e0f:3616
(anonymous) @ blob:http://localhosā¦1-e33a40325e0f:2899
_callTimer @ blob:http://localhosā¦1-e33a40325e0f:2788
_callImmediatesPass @ blob:http://localhosā¦1-e33a40325e0f:2824
callImmediates @ blob:http://localhosā¦1-e33a40325e0f:3043
__callImmediates @ blob:http://localhosā¦1-e33a40325e0f:2377
(anonymous) @ blob:http://localhosā¦1-e33a40325e0f:2204
__guardSafe @ blob:http://localhosā¦1-e33a40325e0f:2361
flushedQueue @ blob:http://localhosā¦1-e33a40325e0f:2203
invokeCallbackAndReturnFlushedQueue @ blob:http://localhosā¦1-e33a40325e0f:2196
(anonymous) @ debuggerWorker.js:70
Both in iOS emulator and real device
Below is my portion of code that caused the issue when execute.
RNIap.prepare()
.then(() => {
RNIap.buySubscription('valid_item_id')
.then(purchase => {
console.warn('Purchase Detail: ' + JSON.stringify(purchase));
RNIap.endConnection();
})
.catch(err => {
console.warn('Purchase Error: ' + JSON.stringify(err));
RNIap.endConnection();
});
})
.catch(err => {
console.warn(err);
});
I also tried to call getSubscriptions and getPurchaseHistory using the same product ID without issue. The getSubscriptions will return the subscription details while getPurchaseHistory return empty array as there is no existing purchase. I am using the user ID in the sandbox testers. On Android device all function works well.
Managed to find out the issue after dig into the ios code RNIapIos.m. I need to call the getSubscriptions() before calling buySubscription(). The reason is there is a variable "validProducts" that need to fill with product data before I can call buySubscription(). Seem like this sequence didn't specify in the README.md.
Most helpful comment
Managed to find out the issue after dig into the ios code RNIapIos.m. I need to call the getSubscriptions() before calling buySubscription(). The reason is there is a variable "validProducts" that need to fill with product data before I can call buySubscription(). Seem like this sequence didn't specify in the README.md.