shareSDK(分享第三方库)的 使用
来源:互联网 发布:域名后缀含义 vip 编辑:程序博客网 时间:2024/05/05 11:44
ShareSDK_v2.4.0新浪登录分享例子:http://pan.baidu.com/share/link?shareid=1290609085&uk=3189484501
这个例子我自己裁剪的官方的例子很好,但代码太多不方便看,其实会一个其他的也就会了。
首先,下载第三方库,可以去官网下载,官网的地址我忘记了,但下面有一个我之前下的和我写的例子,其实官方的例子也写我们只是告诉大家用时需要把哪些代码复制出来就可以用了。
1、导入如下框架和第三方库
新浪微博分享例子下载:http://vdisk.weibo.com/s/BDn59yfnBUifA
下面是微博分享的代码里子:
-(IBAction)shareSina:(id)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:@"fenxiang" defaultContent:@"" image:[UIImage imageNamed:@"f"] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeSinaWeibo content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}
这些代码例子可以在官方提供的例子中找到,官方例子下载地址:http://vdisk.weibo.com/s/BDn59yfnBUiAb
都在AGApiViewController.m这个类中,大家找到这类就可以在里面找到对应的方法。
/** *@brief分享到新浪微博 * *@param sender 事件对象 */- (void)shareToSinaWeiboClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeSinaWeibo content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil]; }/** *@brief分享到腾讯微博 * *@param sender 事件对象 */- (void)shareToTencentWeiboClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeTencentWeibo content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享给QQ好友 * *@param sender 事件对象 */- (void)shareToQQFriendClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText title:@"ShareSDK" url:@"http://www.sharesdk.cn" musicFileUrl:nil extInfo:nil fileData:nil]; [ShareSDK shareContentWithType:ShareTypeQQ content:publishContent containerController:self statusBarTips:NO oneKeyShareList:nil shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享到QQ空间 * *@param sender 事件对象 */- (void)shareToQQSpaceClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [publishContent addQQSpaceUnitWithTitle:@"Hello QQ空间" url:@"http://www.sharesdk.cn" comment:INHERIT_VALUE summary:CONTENT image:INHERIT_VALUE imageQuality:INHERIT_VALUE type:INHERIT_VALUE playUrl:nil syncWeibo:nil]; [ShareSDK shareContentWithType:ShareTypeQQSpace content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享给微信好友 * *@param sender 事件对象 */- (void)shareToWeixinSessionClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText title:@"ShareSDK" url:@"http://www.sharesdk.cn" musicFileUrl:nil extInfo:nil fileData:nil]; [ShareSDK shareContentWithType:ShareTypeWeixiSession content:publishContent containerController:self statusBarTips:NO oneKeyShareList:nil shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享给微信朋友圈 * *@param sender 事件对象 */- (void)shareToWeixinTimelineClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeNews title:@"ShareSDK" url:@"http://www.baidu.com" musicFileUrl:nil extInfo:nil fileData:nil]; [ShareSDK shareContentWithType:ShareTypeWeixiTimeline content:publishContent containerController:self statusBarTips:YES autoAuth:YES convertUrl:YES shareViewOptions:nil result:nil];}/** *@brief分享到网易微博 * *@param sender 事件对象 */- (void)shareTo163WeiboClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareType163Weibo content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享到搜狐微博 * *@param sender 事件对象 */- (void)shareToSohuWeiboClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeSohuWeibo content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享到人人网 * *@param sender 事件对象 */- (void)shareToRenRenClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeRenren content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享到开心网 * *@param sender 事件对象 */- (void)shareToKaiXinClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeKaixin content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享到豆瓣我说 * *@param sender 事件对象 */- (void)shareToDouBanClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeDouBan content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享到Instapaper * *@param sender 事件对象 */- (void)shareToInstapaperClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeInstapaper content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享到Facebook * *@param sender 事件对象 */- (void)shareToFacebookClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeFacebook content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief分享到Twitter * *@param sender Twitter */- (void)shareToTwitterClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeTwitter content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:nil];}/** *@brief短信分享 * *@param sender 事件对象 */- (void)shareBySMSClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeSMS content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:^(ShareType type, SSPublishContentState state, id<ISSStatusInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) { if (state == SSPublishContentStateSuccess) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"分享成功" delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles: nil]; [alertView show]; [alertView release]; } else if(state == SSPublishContentStateFail) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:error.errorDescription delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles: nil]; [alertView show]; [alertView release]; } }];}/** *@brief邮件分享 * *@param sender 事件对象 */- (void)shareByMailClickHandler:(UIButton *)sender{ id<ISSPublishContent> publishContent = [ShareSDK publishContent:CONTENT defaultContent:@"" image:[UIImage imageNamed:IMAGE_NAME] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText]; [ShareSDK shareContentWithType:ShareTypeMail content:publishContent containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList] shareViewStyle:ShareViewStyleDefault shareViewTitle:@"内容分享" result:^(ShareType type, SSPublishContentState state, id<ISSStatusInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) { if (state == SSPublishContentStateSuccess) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"分享成功" delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles: nil]; [alertView show]; [alertView release]; } else if(state == SSPublishContentStateFail) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:error.errorDescription delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles: nil]; [alertView show]; [alertView release]; } }];}
- shareSDK(分享第三方库)的 使用
- sharesdk的使用,有关分享和第三方登录
- 使用sharesdk 进行第三方分享的流程
- ShareSDK 第三方分享
- ShareSdk第三方分享
- shareSDK使用小总结(分享+第三方授权登陆)
- 使用ShareSDK进行第三方(登录,分享)
- 使用shareSDK来进行第三方分享
- 通过使用第三方SDK来实现应用的分享,第三方登陆,数据信息统计等功能(ShareSDK)。
- shareSDK第三方分享问题
- shareSDK第三方分享问题
- shareSDK第三方分享完整版
- 调用ShareSDK第三方分享
- 6.8.1 使用ShareSDK 实现第三方分享,登录 微博,
- Unity3d 使用ShareSDK做分享和第三方登录功能
- 【第三方SDK】使用ShareSDK实现新浪微博的一键分享功能
- 【Android进阶】使用第三方平台 ShareSDK 实现新浪微博的一键分享功能
- 使用第三方平台 ShareSDK 实现新浪微博的一键分享功能
- 百位架构师调查:新趋势下IT架构的变迁
- 几种流行Webservice框架性能对比 .
- Struts完美解决i18n问题
- C++中的operator new与new operator区别
- 使用git 本地文件(2)----连载
- shareSDK(分享第三方库)的 使用
- 我看Windows 8 RT
- Lucene采用自定义分词器
- 三十之惑–面霸的八月(第一部分)
- 提高ASP.NET应用程序性能的十大方法
- 各种组件使用以及详解和各种小demo地址集
- 三十之惑–面霸的八月(第二部分)
- 针对IE10的CSS Hack(User-agent方法)
- 新站不被百度收录