videokit-ai / natshare

Cross-platform social sharing for Unity Engine.
https://github.com/natmlx/videokit
Apache License 2.0
134 stars 28 forks source link

Share crash on iOS 12/13 #57

Closed skibitsky closed 5 years ago

skibitsky commented 5 years ago

An empty scene with one button that executes:

var texture = ScreenCapture.CaptureScreenshotAsTexture(2);
NatShare.Share(texture);

It works on Android, but crashes on iOS. Tested on iOS 12 Simulator and iOS13 Public Beta 2 device. Logs are attached.

NativeShare Device iOS13.txt NativeShare Simulator iOS12.txt

We used the latest NatShare 1.2 version from GitHub. Unity version: 2019.1.7f1

Thank you.

smxthereisonlyone commented 5 years ago

I have the same issue, how can we fix it?

olokobayusuf commented 5 years ago

And can you confirm that you are not calling Share from a background thread?

skibitsky commented 5 years ago

@olokobayusuf Yes, definitely called from thread 0. See the test project attached below. Crashes in the simulator.

Screenshot 2019-07-26 at 14 29 11

Crash.txt NatShareTest.zip

olokobayusuf commented 5 years ago

Okay I'm gonna try to reproduce.

olokobayusuf commented 5 years ago

Can you try the code in #49 ? Works for me on iOS 12.

olokobayusuf commented 5 years ago

Yup #49 definitely fixes this. The cause of the crash was probably because of the requestAuthorization block, which likely invoked the block on a separate thread (hence causing the main thread crash).

skibitsky commented 5 years ago

I confirm that it works on iOS 13 device. Thank you!

Ruslan-molodec commented 4 years ago

I have the same problem, but I can’t understand how to use code #49

olokobayusuf commented 4 years ago

I have the same problem, but I can’t understand how to use code #49

Have you looked at the README?

Ruslan-molodec commented 4 years ago

Yes, I figured it out! Thanks!😉

пт, 13 дек. 2019 г. в 19:44, Yusuf Olokoba notifications@github.com:

I have the same problem, but I can’t understand how to use code #49 https://github.com/natsuite/NatShare-API/pull/49

Have you looked at the README https://github.com/natsuite/NatShare-API/tree/payload-api/Assets/NatShare ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/natsuite/NatShare-API/issues/57?email_source=notifications&email_token=AOA6B4BVZQCI57WE5BD6GTTQYONUTA5CNFSM4IBFKNC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG2FJVY#issuecomment-565466327, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOA6B4GNEXAQBFJTSXCQ2O3QYONUTANCNFSM4IBFKNCQ .