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

An unknown or unexpected error has occured - react-native-iap #191

Closed
immohdali opened this issue Jun 12, 2018 · 32 comments
Closed

An unknown or unexpected error has occured - react-native-iap #191

immohdali opened this issue Jun 12, 2018 · 32 comments
Labels
📱 iOS Related to iOS ❓ question Further information is requested

Comments

@immohdali
Copy link

Getting error after login to apple for in app purchase payment

Err. message - An unknown or unexpected error has occured. Please try again later.

Err.Code - E_UNKNOWN

First I am loading product via product id then calling for payment

async buyplan() {
try {
await RNIap.prepare();
const products = await RNIap.getProducts([${this.state.productid}]);
await RNIap.buyProduct(this.state.productid).then(purchase => {
Toast.show("Payment Successfully Completed");
}).catch(err => {
// Toast.show("Payment Transaction Failed");
console.warn(err);
alert(err.message);
})
} catch (err) {
console.warn(err);
}
}

simulator screen shot - iphone 6 - 2018-06-12 at 14 59 36

Please help me out from this.
Thanks in advance.

@hyochan
Copy link
Member

hyochan commented Jun 12, 2018

@immohdali Could you please fill up issue again based on below format so we can help?

Version of react-native-iap

Platforms you faced the error (IOS or Android or both?)

Expected behavior

Actual behavior

Tested environment (Emulator? Real Device?)

Steps to reproduce the behavior

Also where exactly is warning occuring? Which line?

@hyochan hyochan added ❓ question Further information is requested 📱 iOS Related to iOS labels Jun 12, 2018
@JJMoon
Copy link
Contributor

JJMoon commented Jun 13, 2018

In your source code.

const products = await RNIap.getProducts([${this.state.productid}]);

Why did you enclose the productid with ${} ? How about to try this ?

const products = await RNIap.getProducts([ this.state.productid ]);

Of course, the productid should be string.

@immohdali
Copy link
Author

Version of react-native-iap
"react-native-iap": "^1.1.6"

Platforms you faced the error (IOS or Android or both?)
Only IOS

Tested environment (Emulator? Real Device?)
Real Device + Simular

Steps to reproduce the behavior
No idea

@immohdali
Copy link
Author

What is a meaning of E_UNKNOWN error..?

please help me it very urgent.

@JJMoon
Copy link
Contributor

JJMoon commented Jun 14, 2018

@immohdali Would you read my answer above ?

@hyochan
Copy link
Member

hyochan commented Jun 14, 2018

@immohdali You are wrapping the two possible err handling at once so it would be better to seperate them and see which line it exactly is occuring.

const products = await RNIap.getProducts([${this.state.productid}]);
await RNIap.buyProduct(this.state.productid).then(purchase => {

Do something like below.

try {
  const products = await RNIap.getProducts([${this.state.productid}]);
} catch (err) {
  console.warn(`getProducts: ${err}`);
}
try {
  await RNIap.buyProduct(this.state.productid).then(purchase => {
    console.log('done')
  }).catch(err => {
    console.warn(`buyProduct: ${err}`);
  })
}

We need to understand the problem to help you out.

@immohdali
Copy link
Author

@JJMoon Yes...

@dooboolab ... I implement your code but still i am getting E_UNKNOWN error after login for payment

@immohdali
Copy link
Author

immohdali commented Jun 14, 2018

   try {
        //await RNIap.prepare();
        const products = await RNIap.getProducts([`${this.state.productid}`]);
      } catch (err) {
        console.warn(`getProducts: ${err}`);
      }

    try {
        await RNIap.buyProduct(this.state.productid).then(purchase => {
            console.warn('done')
        }).catch(err => {
            console.warn(`buyProduct: ${err}`);
        })
    }catch (err) {
        console.warn(`try error: ${err}`);
      }

simulator screen shot - iphone 6 - 2018-06-14 at 14 14 57

@hyochan
Copy link
Member

hyochan commented Jun 15, 2018

@immohdali Alright, you are having problem from getting product which means your app is having problem fetching in-app items. Have you followed blog? Have you checked your product id?

@immohdali
Copy link
Author

immohdali commented Jun 15, 2018

No.. products are fetching properly. it will be helpful if u help me via teamviewer

Its very urgent for me

@hyochan
Copy link
Member

hyochan commented Jun 15, 2018

@immohdali Alright. Today, I am out of time. I'll comeback 18 hours later from now. Is it fine?

@immohdali
Copy link
Author

Its only 2 min work for you...actually from tomorrow 2 days holidays. I hope you understand

@immohdali
Copy link
Author

if you want i will share you files you can update and send me again

@hyochan
Copy link
Member

hyochan commented Jun 15, 2018

@immohdali I am working on phone right now and will not stay with my pc for today.. Yeah it will be better if you can share the repo instead files. Also you should share itunnesconnect account too so I can access your in app items. My email address is dooboolab@gmail.com

@immohdali
Copy link
Author

Repo link - https://github.com/immohdali/janmo.git

I added my src folder where all components

Its a matrimonial site below i shared you login access when u will click on profile chat icon it will redirect you to membership screen.

Login Details :
Email : prasad@gmail.com
Password : 123456

@hyochan
Copy link
Member

hyochan commented Jun 16, 2018

@immohdali Hey, I've just looked your repo and I can't help you with this. You gotta give me your complete building environment to just start the project. Also you've not given me your itunesconnect which I can't help either. You should think yourself how to help somebody like you. You are wasting my time~

@immohdali
Copy link
Author

@dooboolab after 2 hours i will be at mac. if possible i will share you my mac control via TeamViewer. i hope you will be free

skype id - immohdali

@hyochan
Copy link
Member

hyochan commented Jun 16, 2018

@immohdali I have to go out exactly after 90 minutes from now.. I'll be back at night which is 8hours from now.

@immohdali
Copy link
Author

immohdali commented Jun 16, 2018 via email

@immohdali
Copy link
Author

no problem i will be there after 8 hours from now

@hyochan
Copy link
Member

hyochan commented Jun 16, 2018

@immohdali Sorry, I think I'll take two more hours to be back home.

@immohdali
Copy link
Author

immohdali commented Jun 16, 2018 via email

@hyochan
Copy link
Member

hyochan commented Jun 16, 2018

I am not using skype. What about slack? Here is invitation link for ReactNativeSeoul.

@hyochan
Copy link
Member

hyochan commented Jun 16, 2018

@immohdali I am on now. Write me something on slack. I'll close this for now. Please add new issue when someone experience same issue.

@hyochan hyochan closed this as completed Jun 16, 2018
@immohdali
Copy link
Author

immohdali commented Jun 16, 2018 via email

@hyochan
Copy link
Member

hyochan commented Jun 17, 2018

@immohdali Can't help you more than that. I've look into your code remotely more than an hour yesterday and told you how to improve your code in slack. It was not a bug or anything but just your immature coding skill. You need to solve your problem yourself. I can answer to your question and guide your coding like I've done yesterday but I won't edit your code anymore. I've done this kind of thing lots of time and I know that it isn't healthy. Won't comeback to this issue either. Also, please see the example project and compare with yours too.

@hsparihar-systango
Copy link

@hyochan @JJMoon
I am facing the same issue on ios, the situation is once I successfully purchased 12 months recurring subscription. Then on sandbox environment on the device when I try to purchase 3 months or any other subscription less than 12 months I asked for sandbox user creds It shows purchase is a success then suddenly getting pop up which says An unknown or unexpected error has occurred." getting this error :
{ [Error: An unknown or unexpected error has occurred. Please try again later.]
framesToPop: 1,
code: 'E_UNKNOWN',
nativeStackIOS:
[ '0 RadioSpirit 0x0000000102bfd3e8 RCTJSErrorFromCodeMessageAndNSError + 152',
'1 RadioSpirit 0x0000000102b96b24 __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.218 + 176',
'2 RadioSpirit 0x0000000102aeeb64 -[RNIapIos rejectPromisesForKey:code:message:error:] + 512',
'3 RadioSpirit 0x0000000102af10ec __45-[RNIapIos paymentQueue:updatedTransactions:]_block_invoke + 348',
'4 libdispatch.dylib 0x0000000104534dc8 _dispatch_client_callout + 16',
'5 libdispatch.dylib 0x000000010454382c _dispatch_lane_barrier_sync_invoke_and_complete + 124',
'6 RadioSpirit 0x0000000102af0e74 -[RNIapIos paymentQueue:updatedTransactions:] + 908',
'7 libdispatch.dylib 0x0000000104533824 _dispatch_call_block_and_release + 24',
'8 libdispatch.dylib 0x0000000104534dc8 _dispatch_client_callout + 16',
'9 libdispatch.dylib 0x0000000104542a78 _dispatch_main_queue_callback_4CF + 1360',
'10 CoreFoundation 0x0000000220894df4 + 12',
'11 CoreFoundation 0x000000022088fcbc + 1964',
'12 CoreFoundation 0x000000022088f1f0 CFRunLoopRunSpecific + 436',
'13 GraphicsServices 0x0000000222b08584 GSEventRunModal + 100',
'14 UIKitCore 0x000000024dbe6d40 UIApplicationMain + 212',
'15 RadioSpirit 0x0000000102996d70 main + 124',
'16 libdyld.dylib 0x000000022034ebb4 + 4' ],
userInfo: { NSLocalizedDescription: 'Cannot connect to iTunes Store' },
domain: 'SKErrorDomain',
line: 2268,
column: 26,
sourceURL: 'http://192.168.1.107:8081/index.bundle?platform=ios&dev=true&minify=false' }

Please help me understand and resolve this situation.

@Desintegrator
Copy link

same issue

@sohanpc
Copy link

sohanpc commented Jul 2, 2021

anybody fine solution? this is very serious error @Desintegrator , @hsparihar-systango @hyochan @immohdali

@hiteshsurani
Copy link

I am facing same issue!!!

@tmxkwkfgka
Copy link

I have same error. but After reboot my cellphone, It works again. maybe There was some problem in playstore app or playstore gmail account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📱 iOS Related to iOS ❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants