I have the following code:
suspend fun pickSystemImage(): ImageContainer =
suspendCancellableCoroutine { continuation ->
MainScope().launch {
NSLog("pickSystemImage MainScope().launch")
val imagePicker = UIImagePickerController()
NSLog("pickSystemImage 1")
// present and handle
}
}
the problem is that initializing
UIImagePickerController
takes huge amount of time - around 6 secs, every time.
2021-01-24 21:56:42.439651+0700 Well[3450:1028035] pickSystemImage MainScope().launch
2021-01-24 21:56:48.593539+0700 Well[3450:1028035] pickSystemImage 1
I’ve tried reproducing this in a test project, and there it works fine.
I’ve tried switching outer scope, as well as creating scope with main context instead of MainScope, or just without switch to an other scope..
I’m out of the ideas where to look for a solution