Commit 6a0dbe0c authored by 艾娇平's avatar 艾娇平

兼容url数据格式

parent 80cd8a7e
......@@ -234,11 +234,13 @@
- (void)QQFriendShareWithParameters: (NSDictionary *)parameters {
UIImage * thumbImage = parameters[ShareImage]?:[UIImage imageNamed:@"icon"];
NSURL* url = parameters[ShareUrl];// ShareUrl 传入的不一定是NSURL,有可能是NSString
if (![url isKindOfClass:[NSURL class]]) {
url = [NSURL URLWithString:url];
}
NSURL* url = parameters[ShareUrl];
NSString *title = parameters[ShareTitle];
NSString *description = parameters[ShareText];
QQApiNewsObject* img = [QQApiNewsObject objectWithURL:url title:title description:description previewImageData:UIImagePNGRepresentation(thumbImage)];
SendMessageToQQReq* req = [SendMessageToQQReq reqWithContent:img];
img.shareDestType = ShareDestTypeQQ;
......@@ -257,7 +259,10 @@
} else {
previewImage = images;
}
NSURL* url = parameters[ShareUrl];
NSURL* url = parameters[ShareUrl];// ShareUrl 传入的不一定是NSURL,有可能是NSString
if (![url isKindOfClass:[NSURL class]]) {
url = [NSURL URLWithString:url];
}
NSString *title = parameters[ShareTitle];
NSString *description = parameters[ShareText];
NSData *data = UIImagePNGRepresentation(previewImage);
......@@ -421,7 +426,13 @@
- (void)wechatMiniProgramWithParameters: (NSDictionary *)parameters scene:(int)scene {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
WXMiniProgramObject *wxMiniObject = [WXMiniProgramObject object];
wxMiniObject.webpageUrl = parameters[ShareUrl];
NSString *webpageUrl = parameters[ShareUrl];// ShareUrl 传入的不一定是NSURL,有可能是NSString
if ([webpageUrl isKindOfClass:[NSURL class]]) {
NSURL *url = (NSURL *)webpageUrl;
webpageUrl = url.absoluteString;
}
wxMiniObject.webpageUrl = webpageUrl;
wxMiniObject.userName = parameters[ShareUserName];
wxMiniObject.path = parameters[SharePath];
// 压缩图片(不大于128K)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment