Anyaa
Anyaa
  • 发布:2015-11-13 09:57
  • 更新:2016-12-06 10:32
  • 阅读:1891

如何用Native.js让代码在主线程中运行

分类:Native.js

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。

请问怎么将最后一行代码放入主线程中运行。

2015-11-13 09:57 负责人:无 分享
已邀请:
tom123

tom123

我是通过NativeJS调用一个本地函数,然后在函数里面使用这个方法实现的。
dispatch_async(dispatch_get_main_queue(), ^{
});

该问题目前已经被锁定, 无法添加新回复