Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buySubscription return E_DEVELOPER_ERROR error in IOS #201

Closed
sekhuat opened this issue Jun 23, 2018 · 1 comment
Closed

buySubscription return E_DEVELOPER_ERROR error in IOS #201

sekhuat opened this issue Jun 23, 2018 · 1 comment
Assignees
Labels
🐛 bug Something isn't working 📱 iOS Related to iOS

Comments

@sekhuat
Copy link

sekhuat commented Jun 23, 2018

Version of react-native-iap

1.2.1

Platforms you faced the error

IOS

Expected behavior

Return the subscription details.

Actual behavior

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

Tested environment

Both in iOS emulator and real device

Steps to reproduce the behavior

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.

@sekhuat
Copy link
Author

sekhuat commented Jun 23, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 📱 iOS Related to iOS
Projects
None yet
Development

No branches or pull requests

3 participants