声明:本文转载自:狮兄
大致报错有以下两点。
1、Main Thread Checker: UI API called on a background thread: -[UIView frame]
PID: 10443, TID: 462862, Thread name: com.taobao.weex.bridge, Queue name: com.apple.root.default-qos.overcommit
2、Main Thread Checker: UI API called on a background thread: -[UIView subviews]
其中Weex库文件中,有两行报错。其中一行如下:
if (!(instance.rootView.subviews) || instance.rootView.subviews.count <=0) {
Xcode中,终端打印报错信息如下
Main Thread Checker: UI API called on a background thread: -[UIView frame]
PID: 998, TID: 202842, Thread name: com.taobao.weex.bridge, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 SinaZC 0x0000000100717b54 +[WXBridgeContext checkEmptyScreen:] + 200
5 SinaZC 0x0000000100716a54 __43+[WXBridgeContext mountContextEnvironment:]_block_invoke_3 + 2920
6 JavaScriptCore 0x000000018a96e178 + 28
7 JavaScriptCore 0x000000018a96d90c + 156
8 SinaZC 0x00000001007cfe24 -[WXJSCoreBridge executeJavascript:withSourceURL:] + 316
9 SinaZC 0x0000000100710cfc __56-[WXBridgeContext createInstance:template:options:data:]_block_invoke + 3240
10 SinaZC 0x0000000100713624 -[WXBridgeContext callJSMethod:args:onContext:completion:] + 764
11 SinaZC 0x000000010070fbc0 -[WXBridgeContext createInstance:template:options:data:] + 4144
12 SinaZC 0x00000001007191d0 __56-[WXBridgeManager createInstance:template:options:data:]_block_invoke + 372
13 SinaZC 0x0000000100718a0c +[WXBridgeManager _performBlockOnBridgeThread:] + 180
14 Foundation 0x00000001846fa0ec + 340
15 CoreFoundation 0x0000000183c57404 + 24
16 CoreFoundation 0x0000000183c56c2c + 276
17 CoreFoundation 0x0000000183c5479c + 1204
18 CoreFoundation 0x0000000183b74da8 CFRunLoopRunSpecific + 552
19 Foundation 0x00000001845e9674 + 304
20 SinaZC 0x0000000100718534 -[WXBridgeManager _runLoopThread] + 344
21 Foundation 0x00000001846f9efc + 1040
22 libsystem_pthread.dylib 0x00000001838d5220 + 272
23 libsystem_pthread.dylib 0x00000001838d5110 + 0
24 libsystem_pthread.dylib 0x00000001838d3b10 thread_start + 4
2018-11-13 10:27:06.709273+0800 SinaZC[998:202842] [reports] Main Thread Checker: UI API called on a background thread: -[UIView frame]
PID: 998, TID: 202842, Thread name: com.taobao.weex.bridge, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 SinaZC 0x0000000100717b54 +[WXBridgeContext checkEmptyScreen:] + 200
5 SinaZC 0x0000000100716a54 __43+[WXBridgeContext mountContextEnvironment:]_block_invoke_3 + 2920
6 JavaScriptCore 0x000000018a96e178 + 28
7 JavaScriptCore 0x000000018a96d90c + 156
8 SinaZC 0x00000001007cfe24 -[WXJSCoreBridge executeJavascript:withSourceURL:] + 316
9 SinaZC 0x0000000100710cfc __56-[WXBridgeContext createInstance:template:options:data:]_block_invoke + 3240
10 SinaZC 0x0000000100713624 -[WXBridgeContext callJSMethod:args:onContext:completion:] + 764
11 SinaZC 0x000000010070fbc0 -[WXBridgeContext createInstance:template:options:data:] + 4144
12 SinaZC 0x00000001007191d0 __56-[WXBridgeManager createInstance:template:options:data:]_block_invoke + 372
13 SinaZC 0x0000000100718a0c +[WXBridgeManager _performBlockOnBridgeThread:] + 180
14 Foundation 0x00000001846fa0ec + 340
15 CoreFoundation 0x0000000183c57404 + 24
16 CoreFoundation 0x0000000183c56c2c + 276
17 CoreFoundation 0x0000000183c5479c + 1204
18 CoreFoundation 0x0000000183b74da8 CFRunLoopRunSpecific + 552
19 Foundation 0x00000001845e9674 + 304
20 SinaZC 0x0000000100718534 -[WXBridgeManager _runLoopThread] + 344
21 Foundation 0x00000001846f9efc + 1040
22 libsystem_pthread.dylib 0x00000001838d5220 + 272
23 libsystem_pthread.dylib 0x00000001838d5110 + 0
24 libsystem_pthread.dylib 0x00000001838d3b10 thread_start + 4
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIView subviews]
PID: 998, TID: 202842, Thread name: com.taobao.weex.bridge, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 SinaZC 0x0000000100717bd8 +[WXBridgeContext checkEmptyScreen:] + 332
5 SinaZC 0x0000000100716a54 __43+[WXBridgeContext mountContextEnvironment:]_block_invoke_3 + 2920
6 JavaScriptCore 0x000000018a96e178 + 28
7 JavaScriptCore 0x000000018a96d90c + 156
8 SinaZC 0x00000001007cfe24 -[WXJSCoreBridge executeJavascript:withSourceURL:] + 316
9 SinaZC 0x0000000100710cfc __56-[WXBridgeContext createInstance:template:options:data:]_block_invoke + 3240
10 SinaZC 0x0000000100713624 -[WXBridgeContext callJSMethod:args:onContext:completion:] + 764
11 SinaZC 0x000000010070fbc0 -[WXBridgeContext createInstance:template:options:data:] + 4144
12 SinaZC 0x00000001007191d0 __56-[WXBridgeManager createInstance:template:options:data:]_block_invoke + 372
13 SinaZC 0x0000000100718a0c +[WXBridgeManager _performBlockOnBridgeThread:] + 180
14 Foundation 0x00000001846fa0ec + 340
15 CoreFoundation 0x0000000183c57404 + 24
16 CoreFoundation 0x0000000183c56c2c + 276
17 CoreFoundation 0x0000000183c5479c + 1204
18 CoreFoundation 0x0000000183b74da8 CFRunLoopRunSpecific + 552
19 Foundation 0x00000001845e9674 + 304
20 SinaZC 0x0000000100718534 -[WXBridgeManager _runLoopThread] + 344
21 Foundation 0x00000001846f9efc + 1040
22 libsystem_pthread.dylib 0x00000001838d5220 + 272
23 libsystem_pthread.dylib 0x00000001838d5110 + 0
24 libsystem_pthread.dylib 0x00000001838d3b10 thread_start + 4
2018-11-13 10:27:07.068187+0800 SinaZC[998:202842] [reports] Main Thread Checker: UI API called on a background thread: -[UIView subviews]
PID: 998, TID: 202842, Thread name: com.taobao.weex.bridge, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 SinaZC 0x0000000100717bd8 +[WXBridgeContext checkEmptyScreen:] + 332
5 SinaZC 0x0000000100716a54 __43+[WXBridgeContext mountContextEnvironment:]_block_invoke_3 + 2920
6 JavaScriptCore 0x000000018a96e178 + 28
7 JavaScriptCore 0x000000018a96d90c + 156
8 SinaZC 0x00000001007cfe24 -[WXJSCoreBridge executeJavascript:withSourceURL:] + 316
9 SinaZC 0x0000000100710cfc __56-[WXBridgeContext createInstance:template:options:data:]_block_invoke + 3240
10 SinaZC 0x0000000100713624 -[WXBridgeContext callJSMethod:args:onContext:completion:] + 764
11 SinaZC 0x000000010070fbc0 -[WXBridgeContext createInstance:template:options:data:] + 4144
12 SinaZC 0x00000001007191d0 __56-[WXBridgeManager createInstance:template:options:data:]_block_invoke + 372
13 SinaZC 0x0000000100718a0c +[WXBridgeManager _performBlockOnBridgeThread:] + 180
14 Foundation 0x00000001846fa0ec + 340
15 CoreFoundation 0x0000000183c57404 + 24
16 CoreFoundation 0x0000000183c56c2c + 276
17 CoreFoundation 0x0000000183c5479c + 1204
18 CoreFoundation 0x0000000183b74da8 CFRunLoopRunSpecific + 552
19 Foundation 0x00000001845e9674 + 304
20 SinaZC 0x0000000100718534 -[WXBridgeManager _runLoopThread] + 344
21 Foundation 0x00000001846f9efc + 1040
22 libsystem_pthread.dylib 0x00000001838d5220 + 272
23 libsystem_pthread.dylib 0x00000001838d5110 + 0
24 libsystem_pthread.dylib 0x00000001838d3b10 thread_start + 4
2018-11-13 10:27:07.178241+0800 SinaZC[998:202842] <Weex>[error]WXMonitor.m:294, [WX_KEY_EXCEPTION_WXBRIDGE] [file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:895:25] ReferenceError: Can't find variable: process
file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:895:25
__webpack_require__@file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:22:34
file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:12052:31
__webpack_require__@file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:22:34
file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:407:36
__webpack_require__@file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:22:34
file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:9725:33
__webpack_require__@file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:22:34
file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:9262:38
__webpack_require__@file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:22:34
file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:9550:32
__webpack_require__@file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:22:34
file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:68:37
global code@file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234:69:12
file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js?random=1715125234
instanceId:0
options:{
bundleType = Vue;
bundleUrl = "file:///var/containers/Bundle/Application/0A0708CB-4F5C-4029-90B9-F2E562643F66/SinaZC.app/bundlejs/views/home.js";
debug = 1;
env = {
appName = "\U65b0\U6d6a\U4f17\U6d4b";
appVersion = "1.8.3";
deviceHeight = 2436;
deviceModel = "iPhone10,3";
deviceWidth = 1125;
logLevel = log;
osName = iOS;
osVersion = "11.4.1";
platform = iOS;
scale = 3;
weexVersion = "0.19.0";
};
}
data:(null)
(
service,
clearTimeout,
setInterval,
clearInterval,
services,
BroadcastChannel,
weex,
setTimeout,
Vue,
getJSFMVersion,
"__WEEX_CALL_JAVASCRIPT__"
)
现象:
iOS项目在手机端运行,直接白屏。
问题查找:
步骤一:
在Weex项目中,执行weex run ios指令时候,终端中打印出如下信息:
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.6.0.beta.2
Analyzing dependencies
Downloading dependencies
Using AMapFoundation (1.5.5)
Using AMapLocation (2.6.1)
Using SDWebImage (3.7.5)
Using SocketRocket (0.4.2)
Using WeexPluginLoader (0.0.1.9.1)
Installing WeexSDK 0.19.0 (was 0.18.0.3)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 5 dependencies from the Podfile and 6 total pods installed.
? Choose one of the following devices (Use arrow keys)
步骤二:
检查Xcode中Podfile 文件。如下:
source 'git@github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
#inhibit_all_warnings!
def common
pod 'WeexSDK',
pod 'WeexPluginLoader'
pod 'SDWebImage', '3.7.5'
pod 'SocketRocket', '0.4.2'
pod 'AMapLocation' #定位SDK
end
target 'WeexDemo' do
common
end
target 'WeexUITestDemo' do
common
end
发现,WeexSDK,并没有指定版本,但是在Weex项目编译过程中,出现过Installing WeexSDK 0.19.0 (was 0.18.0.3),说明,这里直接将老的0.18.0.3版本升级到了0.19.0版本。
步骤三:
修改Xcode的Podfile文件,指定WeexSDK版本为0.18.0.3版本
修改后的Podfile文件如下:
source 'git@github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
#inhibit_all_warnings!
def common
pod 'WeexSDK', '0.18.0.3'
pod 'WeexPluginLoader'
pod 'SDWebImage', '3.7.5'
pod 'SocketRocket', '0.4.2'
pod 'AMapLocation' #定位SDK
end
target 'WeexDemo' do
common
end
target 'WeexUITestDemo' do
common
end
步骤四:
进入到Xcode项目根目录:
在终端中,输入指令pod install ,更新cocoapods相关库。
终端信息如下:
ShiXiongweideMacBook-Pro:ios shixiongwei$ pwd
/Users/shixiongwei/Documents/hctl/demo/blt4/blt-app-viewer/platforms/ios
ShiXiongweideMacBook-Pro:ios shixiongwei$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin17/rbconfig.rb:215: warning: Insecure world writable dir /Users/shixiongwei/ConfigDefine/SXWConfig/hadoop-3.1.1/bin in PATH, mode 040777
Analyzing dependencies
Downloading dependencies
Using AMapFoundation (1.5.5)
Using AMapLocation (2.6.1)
Using SDWebImage (3.7.5)
Using SocketRocket (0.4.2)
Using WeexPluginLoader (0.0.1.9.1)
Using WeexSDK (0.19.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 5 dependencies from the Podfile and 6 total pods installed.
ShiXiongweideMacBook-Pro:ios shixiongwei$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin17/rbconfig.rb:215: warning: Insecure world writable dir /Users/shixiongwei/ConfigDefine/SXWConfig/hadoop-3.1.1/bin in PATH, mode 040777
Analyzing dependencies
Downloading dependencies
Using AMapFoundation (1.5.5)
Using AMapLocation (2.6.1)
Using SDWebImage (3.7.5)
Using SocketRocket (0.4.2)
Using WeexPluginLoader (0.0.1.9.1)
Installing WeexSDK 0.18.0.3 (was 0.19.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 5 dependencies from the Podfile and 6 total pods installed.
步骤五:
Xcode项目运行。不报错了。
网友评论