nixzhu / monkeyking Goto Github PK
View Code? Open in Web Editor NEWMonkeyKing helps you to post messages to Chinese Social Networks.
License: MIT License
MonkeyKing helps you to post messages to Chinese Social Networks.
License: MIT License
仅通过图片方式分享到私聊的图片是 .dat
格式,在微信里没有长按出菜单(识别二维码)的行为。微信原生 SDK 在分享图片时可以指定 imageUrl
来分享
官方SDK中使用的是一个数组。MonkeyKing中使用的是字符串。
目前 MonkeyKing 会直接用 code
从本地发起后续请求再进行回调,但我们在 client 不存放 app key,而是选择把 code 交由服务器再进一步获取用户信息。
这实现起来蛮简单,我想提一个 PR,但因为没有 code guideline 不好入手,望 repo 主给一点建议?
如果没有安装 QQ, 无法打开网页授权页面
2015-11-19 14:53:39.589 China[1989:80597] -canOpenURL: failed for URL: "mqqapi://" - error: "(null)"
未安装新浪微博时采用网页进行认证,OAuth callback 会调用两次,第一次调用 error 不为空,包含 redirect url 信息,第二次 callback dictionary 中包含了有效的 uid 和 accessToken.
我在集成问下微信支付的时候遇到的一点问题,希望得到帮助。
因为项目中并没有用到pay.php中的配置,所已我在客户端自己通过服务端返回的参数够建了一个 MonkeyKing.Order
下面是一些示例代码
// 构建一个 MonkeyKing.Order `signType` 为 `MD5`
let orderString = "weixin://app/\(appID)/pay/?nonceStr=\(nonceStr)&package=Sign=WXPay&partnerId=\(partnerId)&prepayId=\(prepayId)&timeStamp=\(timestamp)&sign=\(sign)&signType=MD5"
let order = MonkeyKing.Order.WeChat(URLString: orderString)
MonkeyKing.payOrder(order) { result in
print("result: \(result)")
}
然而这段代码 Don't Works
然后我查看 pay.php 的源码,发现在签名时候用的是 MD5 的加密方式 $sign=strtoupper(md5($sign));
但是在返回给客户端的是$iOSLink=sprintf("weixin://app/%s/pay/?nonceStr=%s&package=Sign%%3DWXPay&partnerId=%s&prepayId=%s&timeStamp=%s&sign=%s&signType=SHA1",$APP_ID,$input["noncestr"],$MCH_ID,$input["prepayid"],$input["timestamp"],$sign);
这里最后一个参数却是 Type=SHA1
让我感到很困惑
你好。MonkeyKing很好用的,遇到了如题的问题。想请问一下怎么去解决。
谢谢!
MonkeyKing also can post message to Wiebo by webpage.
跳回来的url: tencent(appid)://response_from_qq?source=qq&source_scheme=mqqapi&error=0&version=1
在handleOpenURL(:_) 的 UIPasteboard.general.data(forPasteboardType: "com.tencent.tencent(account.appID)")这里 ,执行的结果是nil
因为这个操作的回调应该要有三种可能性, 操作成功 \ 操作失败 \ 取消操作. 而目前少了 取消操作
这个情况的处理.
就是我的项目现在遇到了一点小问题,查了很多不知道怎么解决,正好我的项目也用到了MonkeyKing,就想可不可以问问你。
这样可以方便很多
In Demo, scope, get_user_info But the Block In DIctionary is
{"access_token" = XXXX;
encrytoken = XXXXX;
"expires_in" = XXXX;
msg = sucess;
openid = XXXXX;
"pay_token" = XXXXXX;
ret = 0;
"user_cancelled" = NO;
}
How to get QQ nikename and avatar_url ?
组装message的时候 thumbnail用UIImage(data: Data()) 这样的方式加载图片URL, 分享失败, 没有任何提示,直接跳到微博APP之后就直接跳回来了, 把thumbnail设为nil 或者UIImage(named: String()) 就可以正常分享. 问题可能出在哪里呢? 是图片过大还是什么?
try china demo but I found wechat not working, also return success: false
MonkeyKing is good to use. I'd like to use the kit to replace damn ShareSDK. I have a question. How can I share one news with image at left, and title with abstract at right?
Thank you very much
是不是SDK本身改过了,现在的代码还未兼容?
为啥通过Pod进来后,Networking这个类还不能引用?这样Oauth的时候获取不了第三方用户的用户基本信息,昵称、头像等。
Dear,
Plan To Add : wechat web Oauth support?
公司项目需要使用到Objective-C + Carthage,openshare没有支持carthage,MonkeyKing没有支持Objective-C,现在有点头疼。
现在你们是用开放平台API接口做的,需要新浪微博SDK提供的那个网页授权页面。
支付宝已经支持分享到会话和生活圈,没有对支付宝"scene"这个字段做处理,代码中是这一行:"scene": [keyUID: 12]
现在所有平台的支持都写在一个文件, 如果有10个分享那就会非常庞大
能否每个平台一个类, 类似UIActivity
让MoneyKing自动加载
这样在扩展的时候MoneyKing不需要动
今天在尝试使用的时候发现 QQ 分享的 Activity 一直不出现,然后发现是 canOpenURL
失败了。于是下载了一个日本版的 QQ(帐号正好在日区),打开 Info.plist 发现 URL Scheme 都是 mqqi*
或者 QQi*
,估计国际版的也一样。
我正在尝试自己用暴力的方式魔改(加一个 QQi
的类型),但是感觉这方式很……不优雅。
请问是否有考虑支持国际版的 QQ 分享?
最近需要用到从APP传递文件到QQ,使用QQ的数据API,使用url:"mqqopensdkdataline://"
用QQ原来的SDK使用方法如下:
@IBAction func sendToQQ(sender: AnyObject) {
let path = (NSBundle.mainBundle().resourcePath! as NSString).stringByAppendingPathComponent(
"testZip.zip")
let data:NSData = NSData(contentsOfFile: path)!
//发送到QQ
let file:QQApiFileObject = QQApiFileObject.objectWithData(data, previewImageData: nil, title: "分享标题", description: "分享描述") as! QQApiFileObject
file.cflag = 16
let req:SendMessageToQQReq = SendMessageToQQReq(content: file)
QQApiInterface.sendReq(req)
}
后来打算使用Monkeyking,但一直失败。不知是否有计划,或者能否指教一下。
我项目中集成了 MonkeyKing 0.6.2,进行 QQ 分享失败。能唤起 QQ,但是 QQ 不能弹出分享界面,也没任何错误提示。
我测试 MonkeyKing 的 Demo 是可以的,而且对比了 Demo 我 我自己项目最后生成的 URL Scheme,没发现异常。
微信登录,用户点击取消之后,回调处理有点问题,block没有调起来
回调的url是wx4868b35061f87885://platformId=wechat
在handleOpenURL(_:)
中跑了这段代码
if let dict = try? PropertyListSerialization.propertyList(from: data, options: PropertyListSerialization.MutabilityOptions(), format: nil) as? [String: Any] {
guard
let account = sharedMonkeyKing.accountSet[.weChat],
let info = dict?[account.appID] as? [String: Any],
let result = info["result"] as? String,
let resultCode = Int(result) else {
return false
}
let success = (resultCode == 0)
sharedMonkeyKing.deliverCompletionHandler?(success)
return success
}
最后 return success
当设备上没安装 QQ 时进行 OAuth 授权会弹出 WKWebView,输入密码之后点击授权出现空白页面且回调没有被调用,经检查是 MonkeyKing.swift line 894 造成,注释掉之后正确跳转到 line 903, 能正确得到 access_token 且关闭 WKWebView,不知道基于什么考虑要加上 line 894?
cocopod 上面没有更新到最新代码 还是原来的http版本的,元旦将至,希望能快点更新到https版本的吧。
作者好, 首先感谢开源.
最近试用没有安装微博APP情况下的OAuth授权. 看了代码的基本原理是用一个webview直接打开"https://open.weibo.cn/oauth2/authorize?client_id", 当代理方法要跳转到我们的redirectURI的时候, 关闭webview.
但是, 没有看明白是怎么把授权的结果返回给APP的?包括授权状态,用户ID等信息.
用QQ登录的时候为什么会弹出要求输入QQ帐号和密码,我集成ShareSDK的就不会,可以直接登录授权。
当手机上已安装 QQ 进行第三方授权时,跳转到 QQ 的登录界面,显示的 app 名称是 「nixApp」,经检查是 MonkeyKing line 1137 有问题,localizedInfoDictionary
是一个 empty dictionary,而不是 nil.
Hello.
Congrats about your clean library and the feature that you gave to us!
But I have a question (and not so much of an issue)
I got the following code from your example
func shareButt(sender:UIButton) {
MonkeyKing.registerAccount(.WeChat(appID: Configs.Wechat.appID, appKey: Configs.Wechat.appKey))
let shareURL = NSURL(string: "https://www.sintayeah.gr/syntages/")!
let info = MonkeyKing.Info(
title: "\(recipeObj[RECIPES_TITLE]!)",
description: "SintaYEAH!",
thumbnail: imageFB,
media: .URL(shareURL)
)
let sessionMessage = MonkeyKing.Message.WeChat(.Session(info: info))
let weChatSessionActivity = AnyActivity(
type: "com.nixWork.China.WeChat.Session",
title: NSLocalizedString("WeChat Session", comment: ""),
image: UIImage(named: "wechat_session")!,
message: sessionMessage,
completionHandler: { success in
print("Session success: \(success)")
}
)
let timelineMessage = MonkeyKing.Message.WeChat(.Timeline(info: info))
let weChatTimelineActivity = AnyActivity(
type: "com.nixWork.China.WeChat.Timeline",
title: NSLocalizedString("WeChat Timeline", comment: ""),
image: UIImage(named: "wechat_timeline")!,
message: timelineMessage,
completionHandler: { success in
print("Timeline success: \(success)")
}
)
let activityViewController = UIActivityViewController(activityItems: [shareURL], applicationActivities: [weChatSessionActivity, weChatTimelineActivity])
presentViewController(activityViewController, animated: true, completion: nil)
}
And my problem is the following.
if i try to share it on facebook it tries to post the link (which it does also for wechat messages and time line but there it loads the thumbnail).
How can i make for Facebook to post the image only? Because now it's trying to post the link and the website doesn't exist yet.
Is there any way to make this happen?
Thanks a lot for your time!
Is MonkeyKing support HTTPS now? Otherwise use NSAppTransportSecurity to configurate exception domain might be reject after 2017.1.1 .
在收到微信登录 发送的手机短信时,点击链接可以回跳到 app,但是在“确认登录”时却没有点击事件,无法获取微信返回的信息,这个问题好像最近才有的
public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
// Pocket OAuth
if let errorString = (error as NSError).userInfo["NSErrorFailingURLStringKey"] as? String, errorString.hasSuffix(":authorizationFinished") {
removeWebView(webView, tuples: (nil, nil, nil))
}
}
这里为什么不需要做removeWebview的处理的?
对WKWebview的这个回调的机制还不是特别清楚. 请教作者?
和微信团队的人确认这点,微信会向 app 返回 Unsupport
错误。
在这备忘一下,要将之前 ImageURL
类型的分享移除掉。
isAppInstalled should be class function which takes parameter as app type (qq,wechat...)
现在 isAppInstalled 是 Account对象的变量 , 我觉得这种使用方法比较合理 -> MokeyKing. isAppInstalled(.QQ)
源代码是这样的
var monkeyking_qqCallbackName: String {
var hexString = String(format: "%02llx", (self as NSString).longLongValue)
while hexString.characters.count < 8 {
hexString = "0" + hexString
}
return "QQ" + hexString
}
}
如果是这样可以吗
var hexString = String(format: "QQ%08llx", (self as NSString).longLongValue)
My app can share data to other platforms successfully. However, when coming back to my app, MonkeyKing has performed the programs below.
MonkeyKing.shareMessage(message) { result in
print("result: (result)")
}
The demo hasn't such problems and shareSDK is also O.K. Any idea about this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.