zoukankan      html  css  js  c++  java
  • iOS 自定义 shareSDK 容器

    - (void)initializePlat

    {

        //添加新浪微博应用

        [ShareSDK connectSinaWeiboWithAppKey:@"3201194191"

                                   appSecret:@"0334252914651e8f76bad63337b3b78f"

                                 redirectUri:@"http://appgo.cn"];

        

        //添加腾讯微博应用

        [ShareSDK connectTencentWeiboWithAppKey:@"801307650"

                                      appSecret:@"ae36f4ee3946e1cbb98d6965b0b2ff5c"

                                    redirectUri:@"http://www.sharesdk.cn"];

        

        //添加QQ空间应用

        [ShareSDK connectQZoneWithAppKey:@"100371282"

                               appSecret:@"aed9b0303e3ed1e27bae87c33761161d"];

        

        //添加微信应用

        [ShareSDK connectWeChatWithAppId:@"wx460cdac783d396b1" wechatCls:[WXApi class]];

        

        //添加QQ应用  100510022    QQ0F0A941E

        

        [ShareSDK connectQQWithAppId:@"QQ0F0A941E" qqApiCls:[QQApi class]];

        

    }

    - (BOOL)application:(UIApplication *)application

          handleOpenURL:(NSURL *)url

    {

        return [ShareSDK handleOpenURL:url

                            wxDelegate:self];

    }

    - (BOOL)application:(UIApplication *)application

                openURL:(NSURL *)url

      sourceApplication:(NSString  *)sourceApplication

             annotation:(id)annotation

    {

        return [ShareSDK handleOpenURL:url

                     sourceApplication:sourceApplication

                            annotation:annotation

                            wxDelegate:self];

    }

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

    {

        

        

        //参数为ShareSDK官网中添加应用后得到的AppKey

        [ShareSDK registerApp:@"10ce745008ef"];

           [self initializePlat];

        **************************************************************

    #pragma mark - 分享

    -(void)onShareSoftwear

    {

        

        NSLog(@"分享");

        NSString *imagePath = [[NSBundle mainBundlepathForResource:@"ShareSDK" ofType:@"jpg"];

        //构造分享内容

        id<ISSContent> publishContent = [ShareSDK content:@"广源铝业软件"

                                           defaultContent:@"广源铝业"

                                                    image:[ShareSDK imageWithPath:imagePath]

                                                    title:@"广源铝业"

                                                      url:@"http://www.apple.com/itunes//us/app"

                                              description:@"广源铝业下载"

                                                mediaType:SSPublishContentMediaTypeNews];

         //自己设置分享平台列表

         NSNumber *sinaWeiBo=[NSNumber numberWithInt:ShareTypeSinaWeibo];

         NSNumber *qqWeiBo=[NSNumber numberWithInt:ShareTypeTencentWeibo];

         NSNumber *weiXinSpace=[NSNumber numberWithInt:ShareTypeWeixiTimeline];

         NSArray * myShareList=  [ShareSDKcustomShareListWithType:sinaWeiBo,qqWeiBo,weiXinSpace,nil];

        //分享设置  就是分享面板上的某些内容的显示样式

        id<ISSShareOptions> shareOptions =[ShareSDK defaultShareOptionsWithTitle:@"一键分享"

                                                                 oneKeyShareList:nil

                                                              cameraButtonHidden:NO

                                                             mentionButtonHidden:NO

                                                               topicButtonHidden:NO

                                                                  qqButtonHidden:YES

                                                           wxSessionButtonHidden:YES

                                                          wxTimelineButtonHidden:YES

                                                            showKeyboardOnAppear:NO

                                                               shareViewDelegate:nil

                                                             friendsViewDelegate:nil

                                                           picViewerViewDelegate:nil ];

        [ShareSDK showShareActionSheet:nil

                             shareList:myShareList

                               content:publishContent

                         statusBarTips:YES

                           authOptions:nil

                          shareOptions: shareOptions

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

                                    if (state == SSResponseStateSuccess)

                                    {

                                        NSLog(@"分享成功");

                                    }

                                    else if (state == SSResponseStateFail)

                                    {

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

                                    }

                                }];

    }

  • 相关阅读:
    vue开发常用技巧总结(一)
    js时间戳转固定日期格式输出处理
    vue恢复初始数据
    Feature Police导致iframe页面无法使用粘贴功能
    页面异步请求canceled 或 network中接口请求成功但无法查看返回值
    我在阿里云做云开发平台
    Python项目中的requirements文件
    Json常用格式
    浅谈开机启动_windows
    mmdetection 报错: AttributeError: ‘ConfigDict‘ object has no attribute ‘pipeline‘
  • 原文地址:https://www.cnblogs.com/someonelikeyou/p/3539641.html
Copyright © 2011-2022 走看看