react-native-wechat
react-native-wechat copied to clipboard
生产环境中调用分享接口会无法分享
测试环境:调用 RNWechat.sendMessage
可以正常发出消息
生产环境:调用 RNWechat.sendMessage
可以唤起微信,点击聊天对象后,无法唤起确定发送弹窗。
【安卓】碰到了同样的问题,debug连真机是可以 分享的,但是release包不行。 ios上是好的
出现这种问题大部分是发生内容不符合微信要求,可能是长度过长、数据格式不正确等原因,可以使用demo中同样类型的消息尝试一次。或者提供下发送的具体内容和报错信息,如果是js报错把调用栈的信息发一下,如果是native报错,把xcode或android studio的调用栈错误信息发一下,这样有助于我找到问题
发送的数据完全拷贝的demo,丝毫不差。我尝试记录了一些log,但是据我分析貌似没有太大帮助。
Release 版本分享不正常时候的日志:
09-16 18:36:07.123 8537 9714 E FA : Task exception on worker thread: java.lang.IllegalStateException: Not initialized: com.google.android.gms.internal.measurement.zzhh.zzch(Unknown Source:11)
09-16 18:36:07.124 8537 9714 E FA : Task exception on worker thread: java.lang.IllegalStateException: Not initialized: com.google.android.gms.internal.measurement.zzhh.zzch(Unknown Source:11)
09-16 18:36:07.125 8537 9714 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:36:07.125 8537 9714 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:36:07.152 8537 8537 W MtkBoostDrawableCache: Clear boost cache
09-16 18:36:07.165 8537 8537 W Resources: Using Boost
09-16 18:36:07.192 8537 9714 E FA : Task exception on worker thread: java.lang.IllegalStateException: AppMeasurement is not initialized: com.google.android.gms.internal.measurement.zzgl.zzch(Unknown Source:15)
09-16 18:36:07.192 8537 9714 E FA : Task exception on worker thread: java.lang.IllegalStateException: Not initialized: com.google.android.gms.internal.measurement.zzhh.zzch(Unknown Source:11)
09-16 18:36:07.193 8537 9714 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:36:07.193 8537 9714 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:36:07.189 8537 8537 W com.tencent.mm: type=1400 audit(0.0:366434): avc: denied { read } for name="u:object_r:graphics_config_prop:s0" dev="tmpfs" ino=2678 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:graphics_config_prop:s0 tclass=file permissive=0
09-16 18:36:07.203 8537 8537 E libc : Access denied finding property "ro.sf.lcd_density"
09-16 18:36:07.203 8537 8537 E InputTransport: ro.sf.lcd_density must be defined as a build property
09-16 18:36:07.211 390 390 W GuiExt : Cannot find GuiExtService
09-16 18:36:07.229 859 859 W android.display: type=1400 audit(0.0:366435): avc: denied { write } for name="logd" dev="tmpfs" ino=8466 scontext=u:r:system_server:s0 tcontext=u:object_r:logd_socket:s0 tclass=sock_file permissive=0
09-16 18:36:07.304 8537 9714 E FA : Task exception on worker thread: java.lang.IllegalStateException: Not initialized: com.google.android.gms.internal.measurement.zzhh.zzch(Unknown Source:11)
09-16 18:36:07.305 8537 9714 E FA : Task exception on worker thread: java.lang.IllegalStateException: Not initialized: com.google.android.gms.internal.measurement.zzhh.zzch(Unknown Source:11)
09-16 18:36:07.305 8537 9714 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:36:07.305 8537 9714 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:36:07.326 8537 9714 E FA : Task exception on worker thread: java.lang.IllegalStateException: AppMeasurement is not initialized: com.google.android.gms.internal.measurement.zzgl.zzch(Unknown Source:15)
09-16 18:36:07.327 8537 9714 E FA : Task exception on worker thread: java.lang.IllegalStateException: Not initialized: com.google.android.gms.internal.measurement.zzhh.zzch(Unknown Source:11)
09-16 18:36:07.327 8537 9714 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:36:07.328 8537 9714 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:36:08.926 1376 1402 E MtkPhoneIntfMgrEx: [setWifiSignalLevel] pheonId:1, rssi:-65, snr:60
下面是 debug 模式下分享正常情况下的日志:
09-16 18:37:35.299 8537 8537 W MtkBoostDrawableCache: Clear boost cache
09-16 18:37:35.314 8537 8537 W Resources: Using Boost
09-16 18:37:35.339 8537 9844 E FA : Task exception on worker thread: java.lang.IllegalStateException: AppMeasurement is not initialized: com.google.android.gms.internal.measurement.zzgl.zzch(Unknown Source:15)
09-16 18:37:35.340 8537 9844 E FA : Task exception on worker thread: java.lang.IllegalStateException: Not initialized: com.google.android.gms.internal.measurement.zzhh.zzch(Unknown Source:11)
09-16 18:37:35.340 8537 9844 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:37:35.340 8537 9844 E FA : Persisted config not initialized. Not logging error/warn
09-16 18:37:35.339 8537 8537 W com.tencent.mm: type=1400 audit(0.0:366475): avc: denied { read } for name="u:object_r:graphics_config_prop:s0" dev="tmpfs" ino=2678 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:graphics_config_prop:s0 tclass=file permissive=0
09-16 18:37:35.351 8537 8537 E libc : Access denied finding property "ro.sf.lcd_density"
09-16 18:37:35.351 8537 8537 E InputTransport: ro.sf.lcd_density must be defined as a build property
09-16 18:37:35.358 390 390 W GuiExt : Cannot find GuiExtService
09-16 18:37:35.379 859 859 W android.display: type=1400 audit(0.0:366476): avc: denied { write } for name="logd" dev="tmpfs" ino=8466 scontext=u:r:system_server:s0 tcontext=u:object_r:logd_socket:s0 tclass=sock_file permissive=0
09-16 18:37:35.474 8537 8537 E libc : Access denied finding property "ro.sf.lcd_density"
09-16 18:37:35.459 8537 8537 W com.tencent.mm: type=1400 audit(0.0:366477): avc: denied { read } for name="u:object_r:graphics_config_prop:s0" dev="tmpfs" ino=2678 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:graphics_config_prop:s0 tclass=file permissive=0
09-16 18:37:35.474 8537 8537 E InputTransport: ro.sf.lcd_density must be defined as a build property
09-16 18:37:35.491 390 390 W GuiExt : Cannot find GuiExtService
09-16 18:37:35.712 1230 1230 W ResourceType: For resource 0x7f0202f0, entry index(752) is beyond type entryCount(3)
09-16 18:37:35.713 1230 1230 W ResourceType: Failure getting entry for 0x7f0202f0 (t=1 e=752) (error -75)
09-16 18:37:35.714 1230 1230 W ImageView: Unable to find resource: 2130838256
09-16 18:37:35.714 1230 1230 W ImageView: android.content.res.Resources$NotFoundException: Resource ID #0x7f0202f0
09-16 18:37:35.714 1230 1230 W ImageView: at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:234)
09-16 18:37:35.714 1230 1230 W ImageView: at android.content.res.Resources.getDrawableForDensity(Resources.java:890)
09-16 18:37:35.714 1230 1230 W ImageView: at android.content.res.Resources.getDrawable(Resources.java:833)
09-16 18:37:35.714 1230 1230 W ImageView: at android.content.Context.getDrawable(Context.java:614)
09-16 18:37:35.714 1230 1230 W ImageView: at android.widget.ImageView.resolveUri(ImageView.java:915)
09-16 18:37:35.714 1230 1230 W ImageView: at android.widget.ImageView.setImageResource(ImageView.java:477)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.AnimatedImageView.setImageResource(AnimatedImageView.java:93)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.phone.StatusBarIconController$DarkIconManager$1.onDarkChanged(StatusBarIconController.java:147)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.phone.DarkIconDispatcherImpl.applyIconTint(DarkIconDispatcherImpl.java:115)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.phone.DarkIconDispatcherImpl.setIconTintInternal(DarkIconDispatcherImpl.java:110)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.phone.DarkIconDispatcherImpl.-wrap0(Unknown Source:0)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.phone.DarkIconDispatcherImpl$1.applyDarkIntensity(DarkIconDispatcherImpl.java:50)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.phone.LightBarTransitionsController.setIconTintInternal(LightBarTransitionsController.java:337)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.phone.LightBarTransitionsController.-wrap0(Unknown Source:0)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.systemui.statusbar.phone.LightBarTransitionsController$2.onAnimationUpdate(LightBarTransitionsController.java:326)
09-16 18:37:35.714 1230 1230 W ImageView: at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1522)
09-16 18:37:35.714 1230 1230 W ImageView: at android.animation.ValueAnimator.animateBasedOnTime(ValueAnimator.java:1316)
09-16 18:37:35.714 1230 1230 W ImageView: at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1446)
09-16 18:37:35.714 1230 1230 W ImageView: at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
09-16 18:37:35.714 1230 1230 W ImageView: at android.animation.AnimationHandler.-wrap2(Unknown Source:0)
09-16 18:37:35.714 1230 1230 W ImageView: at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
09-16 18:37:35.714 1230 1230 W ImageView: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1006)
09-16 18:37:35.714 1230 1230 W ImageView: at android.view.Choreographer.doCallbacks(Choreographer.java:804)
09-16 18:37:35.714 1230 1230 W ImageView: at android.view.Choreographer.doFrame(Choreographer.java:729)
09-16 18:37:35.714 1230 1230 W ImageView: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:994)
09-16 18:37:35.714 1230 1230 W ImageView: at android.os.Handler.handleCallback(Handler.java:794)
09-16 18:37:35.714 1230 1230 W ImageView: at android.os.Handler.dispatchMessage(Handler.java:99)
09-16 18:37:35.714 1230 1230 W ImageView: at android.os.Looper.loop(Looper.java:176)
09-16 18:37:35.714 1230 1230 W ImageView: at android.app.ActivityThread.main(ActivityThread.java:6662)
09-16 18:37:35.714 1230 1230 W ImageView: at java.lang.reflect.Method.invoke(Native Method)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
09-16 18:37:35.714 1230 1230 W ImageView: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
我也没看出和分享直接相关的日志,你有用demo里面相应的消息试过吗,最好把发的消息也粘出来(去掉敏感信息)
我是把 demo 里面的 App.js 及相关文件复制过来的。debug 模式下都可以正常分享,一旦 release 之后唤起微信没问题,点击头像就没反应了。另:release 版本微信登录是正常的,排除了签名不正确的问题。这个问题不太好解决,我尝试记录各种 log 都没有拿到有帮助的信息。
await RNWechat.sendMessage({
scene: Constants.SCENE,
messageType: RNWechat.MessageType.Webpage,
messageTitle: "专访张小龙:产品之上的世界观",
messageDesc:
"微信的平台化发展方向是否真的会让这个原本简洁的产品变得臃肿?在国际化发展方向上,微信面临的问题真的是文化差异壁垒吗?腾讯高级副总裁、微信产品负责人张小龙给出了自己的回复。",
messageThumb: IMAGES.base64,
url: '"http://tech.qq.com/zt2012/tmtdecode/252.htm'
})
issue 先记录一下,等你这边有条件了再来测试一下 @yyyyu