http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 3315|回复: 2

[综合] 【iOS开发实用框架】集成友盟分享

[复制链接]
发表于 2019-1-12 20:58:38 | 显示全部楼层 |阅读模式
本帖最后由 竹林风 于 2019-1-12 21:00 编辑



  导读

【iOS开发实用框架】基础教程目录    http://www.sufeinet.com/thread-24348-1-1.html
【iOS开发实用框架】实例目录贴    http://www.sufeinet.com/thread-24654-1-1.html


26FF675321F68C776CD01FBD9F8E81EE.png

主要代码:

[Objective-C] 纯文本查看 复制代码
UIButton *btnShare = [MTools createButtonWithTitle:@"分享" Font:kFont(18) TitleColor:kColor(orangeColor)];
    btnShare.frame = CGRectMake(50, 80, ScreenWidth - 100, 50);
    [btnShare addButtonClickBlock:^(UIButton *btn) {
        [YNShareTool shareMessageToViewController:self title:@"分享" shareText:@"这是分享内容" url:@"https:[url=http://www.baidu.com]www.baidu.com[/url]" ThumbImage:nil];
    }];
    [self.view addSubview:btnShare];


相关配置

1. SDK位置

F018FCD59481206799B77678E9378DE9.png

2.修改友盟Appkey 以及第三方平台的Appkey 和AppSecure

519F2230-D434-4B89-936F-4945145907E9.png

3.修改URL Types

02A144BE0A74952287DEE278F66D5DF1.png

4.调用方法封装在 YNShareTool.m

DB2287342AFB06685545E8FC19ADF94B.png

1).直接调用默认分享面版

[Objective-C] 纯文本查看 复制代码
+ (void)shareMessageToViewController:(UIViewController *)viewController title:(NSString *)title shareText:(NSString *)text url:(NSString *)url ThumbImage:(id)thumbImage
{

    
    [UMSocialUIManager setPreDefinePlatforms:@[@(UMSocialPlatformType_WechatSession),
                                               @(UMSocialPlatformType_WechatTimeLine),
                                               @(UMSocialPlatformType_QQ),
                                               @(UMSocialPlatformType_Qzone),
//                                               @(UMSocialPlatformType_TencentWb),
                                               @(UMSocialPlatformType_Sina),
                                               ]];


    [UMSocialShareUIConfig shareInstance].sharePageGroupViewConfig.sharePageGroupViewPostionType = UMSocialSharePageGroupViewPositionType_Bottom;
    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageItemStyleType = UMSocialPlatformItemViewBackgroudType_None;
    [UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {

        //                [self runShareWithType:platformType];
        showWithText(@"分享中...");

        [YNShareTool shareWithType:platformType ThumbImage:thumbImage Content:text Title:title ShareUrl:url ViewController:viewController];

    }];

}


可修改需要显示的分享平台

2)分享到指定平台

[Objective-C] 纯文本查看 复制代码
//分享到指定平台
+(void)shareWithType:(NSInteger)platform ThumbImage:(id)thumbImage Content:(NSString *)shareContent Title:(NSString *)title ShareUrl:(NSString *)shareUrl ViewController:(UIViewController *)view{


    //创建分享消息对象
    UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];

    //创建网页内容对象
    UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:shareContent thumImage:thumbImage];
    //设置网页地址
    shareObject.webpageUrl = shareUrl;

    //分享消息对象设置分享内容对象
    messageObject.shareObject = shareObject;
    //调用分享接口
//    dismissHUD();
    [[UMSocialManager defaultManager] shareToPlatform:platform messageObject:messageObject currentViewController:view completion:^(id data, NSError *error) {
        dismissHUD();
        if (error) {
            NSLog(@"************Share fail with error %@*********",error);
//            showInfoTips(@"");
        }else{
//            dismissHUD();
            NSLog(@"share success: response data is %@",data);
        }
    }];
}


附件:链接:https://pan.baidu.com/s/1KmELMh8xKSE3BGIjUZv4VQ  密码:qq6b







1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2019-1-13 17:54:31 | 显示全部楼层
强烈支持楼主ing……
发表于 2019-1-14 14:46:35 | 显示全部楼层
强烈支持楼主ing……
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-3-29 18:49

© 2014-2021

快速回复 返回顶部 返回列表