iOS 自定義 shareSDK 容器
- (void)initializePlat
{
//添加新浪微博應(yīng)用
[ShareSDK connectSinaWeiboWithAppKey:@"3201194191"
appSecret:@"0334252914651e8f76bad63337b3b78f"
redirectUri:@"http://appgo.cn"];
//添加騰訊微博應(yīng)用
[ShareSDK connectTencentWeiboWithAppKey:@"801307650"
appSecret:@"ae36f4ee3946e1cbb98d6965b0b2ff5c"
redirectUri:@"http://www.sharesdk.cn"];
//添加QQ空間應(yīng)用
[ShareSDK connectQZoneWithAppKey:@"100371282"
appSecret:@"aed9b0303e3ed1e27bae87c33761161d"];
//添加微信應(yīng)用
[ShareSDK connectWeChatWithAppId:@"wx460cdac783d396b1" wechatCls:[WXApi class]];
//添加QQ應(yīng)用 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
{
//參數(shù)為ShareSDK官網(wǎng)中添加應(yīng)用后得到的AppKey
[ShareSDK registerApp:@"10ce745008ef"];
[self initializePlat];
**************************************************************
#pragma mark - 分享
-(void)onShareSoftwear
{
NSLog(@"分享");
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"ShareSDK" ofType:@"jpg"];
//構(gòu)造分享內(nèi)容
id<ISSContent> publishContent = [ShareSDK content:@"廣源鋁業(yè)軟件"
defaultContent:@"廣源鋁業(yè)"
image:[ShareSDK imageWithPath:imagePath]
title:@"廣源鋁業(yè)"
url:@"http://www.apple.com/itunes//us/app"
description:@"廣源鋁業(yè)下載"
mediaType:SSPublishContentMediaTypeNews];
//自己設(shè)置分享平臺列表
NSNumber *sinaWeiBo=[NSNumber numberWithInt:ShareTypeSinaWeibo];
NSNumber *qqWeiBo=[NSNumber numberWithInt:ShareTypeTencentWeibo];
NSNumber *weiXinSpace=[NSNumber numberWithInt:ShareTypeWeixiTimeline];
NSArray * myShareList= [ShareSDKcustomShareListWithType:sinaWeiBo,qqWeiBo,weiXinSpace,nil];
//分享設(shè)置 就是分享面板上的某些內(nèi)容的顯示樣式
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]);
}
}];
}
posted on 2014-02-07 16:11 ACM_Someone like you 閱讀(380) 評論(0) 收藏 舉報
浙公網(wǎng)安備 33010602011771號