我有一个要求,我希望将不同的数据集与 kotlin 多平台模块生成的库一起提供,以适应不同的风格,例如开发和生产。在Android项目中,我们可以使用应用程序的build.gradle中的productFlavors。
在 Kotlin Multiplatform 中是否有类似的方法可以做到这一点?
更新:如果我首先在没有超时的情况下执行协程然后使用超时,它会起作用。但是如果我先执行一个协程 withTimeout 那么它会给我一个错误。异步也是如此。
我正在创建一个演示 kotlin 多平台应用程序,我在其中使用 ktor 执行 API 调用。我想在 ktor 请求上有一个可配置的超时函数,所以我在协程级别使用 withTimeout 。
这是我使用网络 API 调用的函数。
suspend fun <T> onNetworkWithTimeOut(
url: String,
timeoutInMillis: Long,
block: suspend CoroutineScope.() -> Any): T {
return withTimeout(timeoutInMillis) {
withContext(dispatchers.io, block)
} as T
}
suspend fun <T> onNetworkWithoutTimeOut(url: String, block: suspend CoroutineScope.() -> Any): T {
return withContext(dispatchers.io, block) as T
}
Run Code Online (Sandbox Code Playgroud)
这是我的 iOSMain 模块的 AppDispatcher 类。
@InternalCoroutinesApi
actual class AppDispatchersImpl : AppDispatchers {
@SharedImmutable
override val main: CoroutineDispatcher =
NsQueueDispatcher(dispatch_get_main_queue())
@SharedImmutable
override …Run Code Online (Sandbox Code Playgroud) 我遇到了Crystal Reports for VS2013的问题.我有一个在VS2010与CR开发的Windows应用程序.
当我尝试在VS 2013中运行它时,我得到以下异常:
Failed to load database information.
Error in File BillReport {E3FDAF36-9149-4F03-BCB6-EE66639AFFFB}.rpt:
Failed to load database information.
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)
at Stock_Maintanance.PrintBillReport.PrintBillReport_Load(Object sender, EventArgs e) in e:\perforce\DudhatTechnologies\Users\jay vadiya\Stock Maintanance\Release 0.1\Stock Maintanance\PrintBillReport.cs:line 86
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr …Run Code Online (Sandbox Code Playgroud)