调用UIActivityViewController直接闪退
import { UIActivityViewController } from 'UIKit'
import { NSExtensionItem, NSItemProvider } from 'Foundation'
import { UTSiOS } from "DCloudUTSFoundation"
export default function fpsPay(t : boolean = false) {
let item = new NSExtensionItem()
let attachment = new NSItemProvider(item = null, typeIdentifier = "hk.com.hkicl")
item.attachments = [attachment]
let activityViewController = new UIActivityViewController(activityItems = [item], applicationActivities = null)
UTSiOS.getCurrentViewController().present(activityViewController, animated = true, completion = null)
}
1 个回复
DCloud_iOS_LZY
uts方法默认会在子线程中执行,涉及 UI 操作必须在主线程中运行,通过 DispatchQueue.main.async 方法可将代码在主线程中运行