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 mainBundle] pathForResource:@"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]);
}
}];
}
posted on 2014-02-07 16:11 ACM_Someone like you 阅读(348) 评论(0) 编辑 收藏 举报
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)