签名不对,请检查包名是否与开放平台上填写的一致。微信分享 errorCode 为-6(方法有两种)

微信分享 errorCode 为-6

解决办法1.自己编译,把MD5加密文件改成小写且去掉:如下图

在这里插入图片描述

解决方法2

下载GenSignature 输入包名 然后生成应用签名
在这里插入图片描述

在微信开放平台创建应用,填写应用签名

  • 11
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
是的,微信开放平台提供了获取微信消息的 API。以下是示例代码,供参考: ```java // 调用微信开放平台的 API 获取微信消息 // 首先需要获取 access_token,具体获取方式参考微信开放平台文档 String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + access_token; JSONObject message = new JSONObject(); message.put("touser", "openid"); // 用户的 openid message.put("msgtype", "text"); message.put("text", new JSONObject().put("content", "Hello World")); HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); connection.setDoOutput(true); OutputStream outputStream = connection.getOutputStream(); outputStream.write(message.toString().getBytes("UTF-8")); outputStream.flush(); outputStream.close(); int responseCode = connection.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { InputStream inputStream = connection.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String line; while ((line = bufferedReader.readLine()) != null) { System.out.println(line); } inputStream.close(); } else { System.out.println("Error: " + responseCode); } ``` 这段示例代码演示了如何使用 Java 语言调用微信开放平台的 API 发送自定义消息。你可以根据自己的需求修改代码,例如获取用户的消息等。需要注意的是,为了使用该 API,你需要在微信开放平台上创建应用,并且获取到相应的权限。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值