首页 > 代码库 > shareSDK

shareSDK

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

{

[ShareSDKregisterApp:@"iSDK"];

    [selfinitializePlat];

}


-(void)initializePlat

{

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

    

    [ShareSDKconnectFacebookWithAppKey:@"474077567543"

                              appSecret:@"64165e36696b1a924ddc445"];

}




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

-(void)twitterShareImage

{

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

                                       defaultContent:@"iSDK"

                                                image:[ShareSDKimageWithPath:bimg.data_small_path]

                                                title:@"iSDK"

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

                                          description:@"iSDK"

                                            mediaType:SSPublishContentMediaTypeNews];


    

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

        if (state ==SSPublishContentStateSuccess)

        {

            NSLog(@"分享成功");

            UIAlertView *alertView = [[UIAlertViewalloc]initWithTitle:nilmessage:NSLocalizedString(@"Share success",nil) delegate:selfcancelButtonTitle:@"OK"otherButtonTitles:nil,nil];

            [alertView show];

        }

        elseif (state == SSPublishContentStateFail)

        {

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

            UIAlertView *alertView = [[UIAlertViewalloc]initWithTitle:nilmessage:NSLocalizedString(@"Share the failure",nil) delegate:selfcancelButtonTitle:@"OK"otherButtonTitles:nil,nil];

            [alertView show];

        }

    }];


}


-(void)facebookShareImage

{

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

                                       defaultContent:@"iSDK"

                                                image:[ShareSDKimageWithPath:bimg.data_small_path]

                                                title:@"iSDK"

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

                                          description:@"iSDK"

                                            mediaType:SSPublishContentMediaTypeNews];

    

    

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

        if (state ==SSPublishContentStateSuccess)

        {

            NSLog(@"分享成功");

            UIAlertView *alertView = [[UIAlertViewalloc]initWithTitle:nilmessage:NSLocalizedString(@"Share success",nil) delegate:selfcancelButtonTitle:@"OK"otherButtonTitles:nil,nil];

            [alertView show];

        }

        elseif (state == SSPublishContentStateFail)

        {

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

            UIAlertView *alertView = [[UIAlertViewalloc]initWithTitle:nilmessage:NSLocalizedString(@"Share the failure",nil) delegate:selfcancelButtonTitle:@"OK"otherButtonTitles:nil,nil];

            [alertView show];

        }

    }];

    

}