本文转载至 http://blog.csdn.net/learnios/article/details/8992346

第一步:首先导入ShareSDK第三方类库,添加依赖框架 :

SystemConfiguration.framework
QuartzCore.framework
MessageUI.framework(如果不集成邮件和短信可以不添加)
libicucore.dylib
libz.1.2.5
第二步:导入头文件#import "ShareSDK.h" 并初始化社交平台APP信息。
AppDelegate.m文件中

-(void)initializePlat{

//添加新浪微博应用  (其他应用添加方法以此类推)

[ShareSDKconnectSinaWeiboWithAppKey:@"3201194191"appSecret:@"0334252914651e8f76bad63337b3b78f"redirectUri:@"http://appgo.cn"];

//添加腾讯微博应用

[ShareSDKconnectTencentWeiboWithAppKey:@"801307650"appSecret:@"ae36f4ee3946e1cbb98d6965b0b2ff5c"redirectUri:@"http://www.sharesdk.cn"];

//添加QQ空间应用

[ShareSDKconnectQZoneWithAppKey:@"100371282"

appSecret:@"aed9b0303e3ed1e27bae87c33761161d"];

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions中添加以下代码

//注册SDK

[ShareSDKregisterApp:@"api20"];

[ShareSDKconvertUrlEnabled:YES];

[selfinitializePlat];

第三步:在一个viewController里面增加一个Button,点击Button开始微博空间分享功能

@implementation ViewController

- (void)viewDidLoad

{

[superviewDidLoad];

UIButton *button = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

button.autoresizingMask =UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin| UIViewAutoresizingFlexibleWidth;

[button setTitle:@"分享全部" forState:UIControlStateNormal];

button.frame =CGRectMake(20,50, 200, 45.0);

[button addTarget:selfaction:@selector(shareAllButtonClickHandler:)forControlEvents:UIControlEventTouchUpInside];

[self.viewaddSubview:button];

}

- (void)shareAllButtonClickHandler:(UIButton *)sender{

NSLog(@"菜单");

NSString *imagePath =  [[NSBundlemainBundle] pathForResource:@"3"ofType:@"jpg"];

id<ISSContainer> container = [ShareSDKcontainer];

id<ISSContent> publishContent = [ShareSDKcontent:@"分享内容"

defaultContent:@"默认分享内容,没内容时显示"

image:[ShareSDKimageWithPath:imagePath]

title:@"ShareSDK"

url:@"http://www.sharesdk.cn"

description:@"这是一条测试信息"

mediaType:SSPublishContentMediaTypeNews]; //分享内容方式(可选择)

[ShareSDKshowShareActionSheet:container

shareList:nil

content:publishContent

statusBarTips:YES

authOptions:nil

shareOptions:nil

result:^(ShareType type,SSPublishContentState state, id<ISSStatusInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {

if (state == SSPublishContentStateSuccess)

{

NSLog(@"分享成功");

}

else if (state ==SSPublishContentStateFail)

{

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

}

}];

}

 
第四步:打开*-Info.plistw文件,在配置文件中新增加一项  URL types(Array),在Array中增加一项 
   Item0            sinaweibosso.2279784657  
新浪微博授权。(如果不添加则会导致新浪微博的SSO授权方式无法返回应用)。

ShareSDK 微博空间分享的更多相关文章

  1. android shareSDK 微博分享案例

    android shareSDK 微博分享案例 ShareSDK APP_KEY 219b1121fc68 腾讯微博 key 801517904 secret bfba83ae253c8f38dabe ...

  2. 分享到微信微博空间等第三方平台的JS代码

    分享功能有利于传播更多优质的内容,所以在web项目中也是比较常用的.今天就抽空整理下常用的分享平台的JS代码.这些代码可以在对应平台的官方网站上生成,官网上对分享内容的参数也有详尽说明.这里只对常用的 ...

  3. 在Android Studio中使用shareSDK进行社会化分享(图文教程)

    [声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...

  4. 利用新版ShareSDK进行手动分享(自定义分享界面)

    之前有用过Share SDK进行快捷分享,可是官方demo中的快捷分享的界面已经设置死了,而公司的产品又设计了自己的分享界面,这就需要我进行手动分享了.当前ShareSDK版本是2.5.4. 看了一堆 ...

  5. android shareSDK实现第三方分享

    一.  http://www.mob.com/  在mob官网注册账号,获取ShareSDK的appkey,下载shareSDK并解压. 二.进入ShareSDK解压目录,打开“Share SDK f ...

  6. QQ空间分享功能(二)

    http://sns.z.qq.com/tools/share/demo_html.jsp  手机QQ空间分享功能接入指引: 1.请求地址: http://sns.z.qq.com/share 2.请 ...

  7. 微博一键分享主要通过对指定 URL 添加各种参数来实现;

    微博一键分享主要通过对指定 URL 添加各种参数来实现:也可以用在线生成器自动生成. 示例: 搜狐微博一键分享 URL,只需三个参数: http://t.sohu.com/third/post.jsp ...

  8. JavaScript实现HTML页面集成QQ空间分享功能

    <!DOCTYPE HTML> <html> <head> <title>QQ空间分享</title> <meta http-equi ...

  9. 【转载】2012年七个免费ASP空间分享-支持ASP、ASP.NET的空间

    文章目录 Azure空间 Appharbor 7host空间 Brinkster Jabry空间 总结后的话 这篇免费ASP空间的总结文章本来标题已经拟好了是:2012年十大免费ASP空间分享,但是当 ...

随机推荐

  1. java 的""和null的区别

    null和""的区别 问题一: null和""的区别 String s=null; string.trim()就会抛出为空的exception String s ...

  2. hibernate.cfg.xml配置文件对关联关系的书写技巧!

    以Department(部门类)和User(用户类)作为例子: 类图如下: 一般hibernate.cfg.xml的配置文件开头都是如下: <?xml version="1.0&quo ...

  3. 泳池水面fresnel 的近似替代

    vs float4 ep = TBMultiply(ModelViewMatrix, FinalPosition); DistFromEye.x = TBSaturate( 10.0 + ep.z / ...

  4. js获取页面传来参数的方法

    function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...

  5. 输出C语言中 变量的类型

    使用gcc的警告信息间接知道变量的类型 #include <stdio.h> #include <stdlib.h> #include <stddef.h> #in ...

  6. iOS_新版iOS11 UITbleView适配的一些问题及解决方法

    // tableView 偏移20/64适配 if (@available(iOS 11.0, *)) { self.tableView.contentInsetAdjustmentBehavior ...

  7. 《学习bash》笔记--进程处理

    1.进程ID和作业编号  当通过附加&号后执行命令时.shell会响应例如以下: $ ls & [1] 3318 当中[1]是作业号,3318是进程号. 一个后台进程完毕时.shell ...

  8. django项目搭建

    参见https://www.imooc.com/video/13931 1.安装python,从官网python.org下载msi安装2.7,安装完后,输入python可以看到版本 2.djangop ...

  9. redmine安装笔记

    切换到redmine安装目录 对所有ip开放启动命令,并且注册为后台运行 nohup ruby bin/rails server webrick -e production -b 0.0.0.0 -p ...

  10. vue-router 响应路由参数的变化

    提醒一下,当使用路由参数时,例如从 /user/foo 导航到 /user/bar,原来的组件实例会被复用.因为两个路由都渲染同个组件,比起销毁再创建,复用则显得更加高效.不过,这也意味着组件的生命周 ...