zoukankan      html  css  js  c++  java
  • shareSDK

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

    {

    [ShareSDK registerApp:@"iSDK"];

        [self initializePlat];

    }


    -(void)initializePlat

    {

        [ShareSDK connectTwitterWithConsumerKey:@"PMLaCYVRN8SdssgpHFRA" consumerSecret:@"1Ie8RO6RwD5n2F4zuiY0PGmUftrgxfgdY" redirectUri:@"http://iSDK.com/"];

        

        [ShareSDK connectFacebookWithAppKey:@"474077567543"

                                  appSecret:@"64165e36696b1a924ddc445"];

    }




    //////////////////////////////////////////

    -(void)twitterShareImage

    {

        id<ISSContent> publishContent = [ShareSDK content:self.show_img.photo_description

                                           defaultContent:@"iSDK"

                                                    image:[ShareSDK imageWithPath:bimg.data_small_path]

                                                    title:@"iSDK"

                                                      url:@"http://www.iSDK.com"

                                              description:@"iSDK"

                                                mediaType:SSPublishContentMediaTypeNews];


        

        [ShareSDK shareContent:publishContent type:ShareTypeTwitter authOptions:nil shareOptions:nil statusBarTips:YES result:^(ShareType type, SSPublishContentState state, id<ISSStatusInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {

            if (state == SSPublishContentStateSuccess)

            {

                NSLog(@"分享成功");

                UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:NSLocalizedString(@"Share success", nil) delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

                [alertView show];

            }

            else if (state == SSPublishContentStateFail)

            {

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

                UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:NSLocalizedString(@"Share the failure", nil) delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

                [alertView show];

            }

        }];


    }


    -(void)facebookShareImage

    {

        id<ISSContent> publishContent = [ShareSDK content:self.show_img.photo_description

                                           defaultContent:@"iSDK"

                                                    image:[ShareSDK imageWithPath:bimg.data_small_path]

                                                    title:@"iSDK"

                                                      url:@"http://www.iSDK.com"

                                              description:@"iSDK"

                                                mediaType:SSPublishContentMediaTypeNews];

        

        

        [ShareSDK shareContent:publishContent type:ShareTypeFacebook authOptions:nil shareOptions:nil statusBarTips:YES result:^(ShareType type, SSPublishContentState state, id<ISSStatusInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {

            if (state == SSPublishContentStateSuccess)

            {

                NSLog(@"分享成功");

                UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:NSLocalizedString(@"Share success", nil) delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

                [alertView show];

            }

            else if (state == SSPublishContentStateFail)

            {

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

                UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:NSLocalizedString(@"Share the failure", nil) delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

                [alertView show];

            }

        }];

        

    }


  • 相关阅读:
    安装wampserver时提示丢失MSVCR110.dll(在windows server上可用)
    前端开发必备!Emmet使用手册
    Markdown 新手指南
    封装系统(以封装Windows 7为例)
    简体中国版文档的Markdown语法
    sublime text 3 快捷键大全以及配置编译环境
    windows下的命令行工具babun
    Android屏幕适配全攻略(最权威的官方适配指导)
    JMETER第五节课jenkis集成常态化压测的实战?主从压力机实战??
    性能测试5--Jmeter命令行与以及普罗米修斯的原理
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/5164288.html
Copyright © 2011-2022 走看看