switch ( plus.os.name ) {
case "iOS":
nwv = plus.ios.currentWebview();
alert("nwv");
// var view = nwv.plusGetAttribute('superView');
var path = plus.io.convertLocalFileSystemURL(param);
alert(path);
var NSURL = plus.ios.importClass('NSURL');
alert(NSURL);
var url = NSURL.fileURLWithPath(path);
alert(url);
var UIDocumentInteractionController = plus.ios.importClass('UIDocumentInteractionController');
var DICtrl = UIDocumentInteractionController.interactionControllerWithURL(url);
DICtrl.plusSetAttribute('url',url);
alert(DICtrl);
var UIScreen = plus.ios.importClass('UIScreen');
var screen = UIScreen.mainScreen();
var frame = screen.plusGetAttribute('bounds');
alert(frame);
DICtrl.presentOptionsMenuFromRectinViewanimated(frame,nwv,'YES');
执行最后一行代码,控制台打印 This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release。
请问怎么将最后一行代码放入主线程中运行。
1 个回复
tom123
我是通过NativeJS调用一个本地函数,然后在函数里面使用这个方法实现的。
dispatch_async(dispatch_get_main_queue(), ^{
});