Jaroslav
10/31/2018, 3:09 PMfun createDeferredString(context: CoroutineContext, doStuff: (() -> String)): Deferred<String> {
return GlobalScope.async(context) {
doStuff()
}
}
then call it from ios app:
func send(command: Command, data: String) -> Kotlinx_coroutines_core_nativeDeferred {
return CoroutineHelperKt.createDeferredString(context: UI(), doStuff: {
return "{}"
})
}
but get this exception:
Uncaught Kotlin exception: kotlin.IllegalStateException: This job has not completed yet
at 0 ios 0x000000010ef15106 kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception + 70
at 1 ios 0x000000010ef15026 kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException + 70
at 2 ios 0x000000010ef217f6 kfun:kotlin.IllegalStateException.<init>(kotlin.String?)kotlin.IllegalStateException + 70
at 3 ios 0x000000010eff139a kfun:kotlinx.coroutines.JobSupport.getCompletedInternal$kotlinx-coroutines-core-native()kotlin.Any? + 330
at 4 ios 0x000000010eff11f8 kfun:kotlinx.coroutines.DeferredCoroutine.getCompleted#internal + 72
any help would be very appreciated!