|
本帖最后由 Bourne 于 2016-2-28 22:31 编辑
我使用微信分享插件 cordova-plugin-wechat里面有个远程获取缩略图 和主页的url 设置
在真机运行的时候 提示超时(日志在下面)
我使用了白名单插件,设置了csp (csp不怎么会设置),不知道哪里的问题
index.html中
<meta http-equiv="Content-Security-Policy" content="default-src *; connect-src *; style-src 'self' 'unsafe-inline'; script-src 'http://www.xxxx-test.com/' 'self' 'unsafe-inline' 'unsafe-eval'">
config.xml中:<content src="index.html"/>
<allow-intent href="*" />
<access origin="*" />
<allow-navigation href="*" />
- Wechat.share({
- message : {
- title : "有个事通知你呦!",
- description : content.task_content,//任务详细内容入参
- mediaTagName : "通知",
- thumb : "http://www.xxxx-test.com/canlight/test.png",//自定义图片
- media : {
- type : Wechat.Type.WEBPAGE,
- webpageUrl : "http://www.xxxx-test.com/canlight" //应用主页,提供下载链接
- }
- },
- //scene : Wechat.Scene.TIMELINE
- // 分享到朋友圈
- scene : Wechat.Scene.SESSION // 分享到微信好友
- }, function() {
- q.resolve("weixinok");
- }, function(reason) {
- q.reject(reason);
- console.log("weixin-reject"+reason);
- });
复制代码 02-28 22:01:22.560: I/System.out(14314): [DataKvKc]:failed to connect to www.xxxx-test.com/11.11.11.11 (port 80): connect failed: ETIMEDOUT (Connection timed out),timeoutMs:0,cause:connect failed: ETIMEDOUT (Connection timed out)
02-28 22:01:22.560: I/System.out(14314): [socket][6:60813] exception
02-28 22:01:22.560: I/System.out(14314): [CDS]close[60813]
02-28 22:01:22.560: W/System.err(14314): java.net.ConnectException: failed to connect to www.xxxx-test.com/11.11.11.11 (port 80): connect failed: ETIMEDOUT (Connection timed out)
02-28 22:01:22.560: W/System.err(14314): at libcore.io.IoBridge.connect(IoBridge.java:117)
02-28 22:01:22.560: W/System.err(14314): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
02-28 22:01:22.560: W/System.err(14314): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
02-28 22:01:22.560: W/System.err(14314): at java.net.Socket.connect(Socket.java:898)
02-28 22:01:22.560: W/System.err(14314): at com.android.okhttp.internal.Platform.connectSocket(Platform.java:152)
02-28 22:01:22.560: W/System.err(14314): at com.android.okhttp.Connection.connect(Connection.java:101)
02-28 22:01:22.560: W/System.err(14314): at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
02-28 22:01:22.560: W/System.err(14314): at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
02-28 22:01:22.560: W/System.err(14314): at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
02-28 22:01:22.560: W/System.err(14314): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
02-28 22:01:22.560: W/System.err(14314): at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
02-28 22:01:22.560: W/System.err(14314): at xu.li.cordova.wechat.Util.downloadAndCacheFile(Util.java:69)
02-28 22:01:22.560: W/System.err(14314): at xu.li.cordova.wechat.Wechat.getFileInputStream(Wechat.java:481)
02-28 22:01:22.560: W/System.err(14314): at xu.li.cordova.wechat.Wechat.getBitmap(Wechat.java:422)
02-28 22:01:22.560: W/System.err(14314): at xu.li.cordova.wechat.Wechat.getThumbnail(Wechat.java:407)
02-28 22:01:22.560: W/System.err(14314): at xu.li.cordova.wechat.Wechat.buildSharingMessage(Wechat.java:327)
02-28 22:01:22.560: W/System.err(14314): at xu.li.cordova.wechat.Wechat$1.run(Wechat.java:189)
02-28 22:01:22.560: W/System.err(14314): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-28 22:01:22.560: W/System.err(14314): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-28 22:01:22.560: W/System.err(14314): at java.lang.Thread.run(Thread.java:841)
02-28 22:01:22.560: W/System.err(14314): Caused by: libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
02-28 22:01:22.560: W/System.err(14314): at libcore.io.Posix.connect(Native Method)
02-28 22:01:22.560: W/System.err(14314): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
02-28 22:01:22.560: W/System.err(14314): at libcore.io.IoBridge.connectErrno(IoBridge.java:142)
02-28 22:01:22.560: W/System.err(14314): at libcore.io.IoBridge.connect(IoBridge.java:112)
|
|