zoukankan      html  css  js  c++  java
  • iOS ShareSDK 使用

      流量精灵软件中,也在大部分地方使用到了shareSDK 这个三方开源库。具体的有两种需求

      a、弹出所有分享模块

      b、只弹出指定的平台:如微信朋友圈和QQ 。

      配置方法,三方库中也很详细,这里我只有写出自出自己代码实现的部分

      这里只写自己实现分享按钮点击弹出的部分代码吧:

    -(void)Share

    {

        NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"50"  ofType:@"png"];

        //这里需要获取URL 地址

        //构造分享内容

        id<ISSContent> publishContent = [ShareSDK content:@"流量精灵下载地址:http://www.mopote.com/lljl/m?from=ios"

                                           defaultContent:@"写下你的感言吧"

                                                    image:[ShareSDK imageWithPath:imagePath]

                                                    title:@"快用流量精灵管理你的流量吧!"  // 这里在微信朋友圈中会显示

                                                      url:@"http://www.mopote.com/lljl/m?from=ios"

                                              description:@"快用流量精灵管理你的流量吧!"

                                                mediaType:SSPublishContentMediaTypeNews];

        //自定义自己需要显示的平台( 这个需求很重要。。。。) 本案例中我只配置了微信朋友圈

       NSArray *shareList= [ShareSDK getShareListWithType:ShareTypeWeixiTimeline, nil];

        [ShareSDK showShareActionSheet:nil

                             shareList:shareList  // 这里设置为nil 时候表示显示所有的平台

                               content:publishContent

                         statusBarTips:NO

                           authOptions:nil

                          shareOptions: nil

                                result:^(ShareType type, SSResponseState state, id<ISSPlatformShareInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {

                                    if (state == SSResponseStateSuccess)

                                    {

                                        NSLog(@"分享成功");

                                    }

                                    else if (state == SSResponseStateFail)

                                    {

                                        NSLog(@"分享失败,错误码:%ld,错误描述:%@", (long)[error errorCode], [error errorDescription]);

                                        UIAlertView *alertView=[[UIAlertView alloc]initWithTitle:@"分享失败" message:@"未安装微信应用" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];

                                        [alertView show];

                                    }else if (state==SSResponseStateBegan)

                                    {

                                    }

                                }];

       }

        其实虽然说测试有时候很烦恼,但是还是挺感谢测试的逼迫,也让自己去研究。。。。解决问题都是被逼的。。。。

  • 相关阅读:
    LeetCode 811. Subdomain Visit Count (子域名访问计数)
    LeetCode 884. Uncommon Words from Two Sentences (两句话中的不常见单词)
    LeetCode 939. Minimum Area Rectangle (最小面积矩形)
    LeetCode 781. Rabbits in Forest (森林中的兔子)
    LeetCode 739. Daily Temperatures (每日温度)
    三种方式实现按钮的点击事件
    239. Sliding Window Maximum
    14.TCP的坚持定时器和保活定时器
    13.TCP的超时与重传
    12.TCP的成块数据流
  • 原文地址:https://www.cnblogs.com/kingbo/p/4121506.html
Copyright © 2011-2022 走看看