Sometimes reproducing the issue is 9/10ths of the battle, and since I am able to reproduce it consistently, I was able to gather information that led me to not only a workaround, but potentially the root cause. I have filed a bug FB17278823 and described my findings therein.
For the benefit of other developers I will describe my workaround here, but be warned that it may not be Apple Store safe (not an issue for me).
The issue as I found it relates to a dispatch call to CoreAnalytics when the plug-in is exiting. This call appears to be hardcoded for five seconds and blocks the main thread.
The workaround is to call _exit(0) after setting the result in the context (allow or deny), which will avoid the atexit handlers, including CoreAnalytics (this is the part that may not be Store safe).
Note: the call must be dispatched async to the main thread, which will allow processing of the credentials to continue.
// Set Allow in the context
let _ = <MyPluginName>.setResult(.allow, engine: self.engine, callbacks: self.plugin.callbacks)
// Skips CoreAnalytics, avoiding the 5‑second hang
DispatchQueue.main.async {
_exit(0)
}
Topic:
Privacy & Security
SubTopic:
General
Tags: