首页 > 其他 > 详细

shareSDK

时间:2014-07-03 17:08:46      阅读:418      评论:0      收藏:0      [点我收藏+]

- (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];

        }

    }];

    

}


shareSDK,布布扣,bubuko.com

shareSDK

原文:http://blog.csdn.net/liuyujinglove/article/details/36616573

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!