在iOS端,componentWillMount或者componentDidMount方法下调用isWeChatInstalled报错,甚至闪退

inkCrazy
2019-09-28 01:40 513 0
Main Thread Checker: UI API called on a background thread: -[UIApplication canOpenURL:]
PID: 4961, TID: 3855340, Thread name: (none), Queue name: com.facebook.react.JShareModuleQueue, QoS: 0
Backtrace:
4 SecurityPlatApp 0x0000000102435734 +[JSHAREService isWeChatInstalled] + 108
5 SecurityPlatApp 0x000000010242fbcc -[RCTJShareModule isWeChatInstalled:] + 108
6 CoreFoundation 0x00000001a4596010 + 144
7 CoreFoundation 0x00000001a4477be0 + 292
8 CoreFoundation 0x00000001a4478814 + 60
9 SecurityPlatApp 0x000000010212f1c8 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2064
10 SecurityPlatApp 0x00000001021c66ac  <em>ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 664
11 SecurityPlatApp 0x00000001021c621c  <em>ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$ <em>0clEv + 144
12 SecurityPlatApp 0x00000001021c6180  <em><strong>ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
13 libdispatch.dylib 0x00000001034936f4  <em>dispatch_call_block_and_release + 24
14 libdispatch.dylib 0x0000000103494c78  <em>dispatch_client_callout + 16
15 libdispatch.dylib 0x000000010349cbf4  <em>dispatch_lane_serial_drain + 712
16 libdispatch.dylib 0x000000010349d8b4  <em>dispatch_lane_invoke + 456
17 libdispatch.dylib 0x00000001034a777c  <em>dispatch_workloop_worker_thread + 1148
18 libsystem_pthread.dylib 0x00000001a41ae114  <em>pthread_wqthread + 304
19 libsystem_pthread.dylib 0x00000001a41b0cd4 start_wqthread + 4
2019-09-28 09:11:23.402 [tid:com.facebook.react.JavaScript] wechat is intalled</em></em></em></em></em></em></strong></em></em></em></em> _____________________
2019-09-28 09:11:23.403 [tid:com.facebook.react.JavaScript] QQ is intalled------------------------------------

null

初始化代码如下:

let shareList = [];

      JShareModule.isWeChatInstalled(isInstalled => {
        if (isInstalled === true) {
          console.debug('wechat is intalled_________________________________');
          shareList.push({
            type: 'wechat_session',
            image: require('../../res/img/ic_wechat.png'),
            text: '微信',
          });

          shareList.push({
            type: 'wechat_timeLine',
            image: require('../../res/img/ic_wxcircle.png'),
            text: '朋友圈',
          });
        } else {
          console.debug(
            'wechat is not installed______________________________',
          );
        }
      });

      JShareModule.isQQInstalled(isInstalled => {
        if (isInstalled === true) {
          console.debug('QQ is intalled------------------------------------');
          shareList.push({
            type: 'qq',
            image: require('../../res/img/ic_qq.png'),
            text: 'QQ',
          });

          shareList.push({
            type: 'qzone',
            image: require('../../res/img/ic_qzone.png'),
            text: 'QQ空间',
          });
        } else {
          console.debug('QQ is not installed--------------------------------');
        }
      });

      this.setState({
        shareList: shareList,
      });
    }

1个回答

热门排序
  • 你使用的 JShare SDK 版本是多少?JShare和JCore的版本
    测试机的系统和机型提供一下
    手机上是否有安装微信?