Open ruslanaplid opened 3 years ago
I'm getting the exact same error.
I noticed that if I put in a debugger break point just under
func loadExtensionContext() -> NSExtensionContext {
The problem stops happening. This leads me to believe that for whatever reason, the extension context WILL load, it just takes time.
As a very, very hacky workaround, I have changed the function to look like:
func loadExtensionContext() -> NSExtensionContext {
// Sleep for 300 ms
let ms = 1000
usleep(useconds_t(300 * ms))
return extensionContext!
}
I realize this is terrible - the problem is that the extension context doesn't seem to load correctly the second time around. The solution is probably to wait for the context to be ready and timeout if it doesn't ready within one second or something.
I don't speak Swift, so I can't really fix it better than this though.
Note that the problem only seems to happen on an actual device.
Sorry to hijack this thread, but I need help with actually using continueInApp() - wondering if any of you here who seem to be using it successfully can lend a hand: #155
@ruslanaplid I'm trying to fix this by comment this line
it has guard, so every time attachViewDelegate is called it will always use previous delegate instead of using new delegate, that's why ExtensionContext not working.
@RZulfikri did it actually fix the issue?
@gilsonviana-modus it works for me, try my PR.
Also fixed it for me.
Would be great to merge the PR or find some better solution though.
Solution fix this
My Share.js
First sharing - ok Second sharing - Fatal error Third - ok
ShareExtension/ReactShareViewController.swift:59: Fatal error: Unexpectedly found nil while unwrapping an Optional value
func loadExtensionContext() -> NSExtensionContext { return extensionContext! }