sharesdk是什么文件夹什么时候推出的

116518人阅读
(1)官方下载ShareSDK iOS 2.8.8,地址:/
(2)根据实际情况,引入相关的库,参考。
(3)在项目的AppDelegate中一般情况下有三个操作,第一是注册ShareSDK,第二是注册各个平台的账号,第三是关于微信等应用的回调处理。
AppDelegate.m
ShareSDKTest
Created by wangdalei on 14-6-23.
Copyright (c) 2014年 王大雷. All rights reserved.
#import &AppDelegate.h&
#import &RootViewController.h&
#import &ShareSDK/ShareSDK.h&
#import &WeiboApi.h&
#import &TencentOpenAPI/QQApiInterface.h&
#import &TencentOpenAPI/TencentOAuth.h&
#import &WXApi.h&
#import &TencentOpenAPI/QQApiInterface.h&
#import &TencentOpenAPI/TencentOAuth.h&
@implementation AppDelegate
@synthesize rootVC;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if (self.rootVC==nil) {
self.rootVC = [[RootViewController alloc]initWithNibName:@&RootViewController& bundle:nil];
UINavigationController *rootNav = [[UINavigationController alloc]initWithRootViewController:self.rootVC];
self.window.rootViewController = rootN
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
&span style=&color:#ff0000;&&[ShareSDK registerApp:@&1a2e7ab5fb6c&];&/span&
&span style=&color:#3366&& //添加新浪微博应用 注册网址
此处需要替换成自己应用的
[ShareSDK connectSinaWeiboWithAppKey:@&&
appSecret:@&1e8f76badf&
redirectUri:@&&];
//添加腾讯微博应用 注册网址 http://dev.
此处需要替换成自己应用的
[ShareSDK connectTencentWeiboWithAppKey:@&&
appSecret:@&ae36f4ee3946e1cbb98dff5c&
redirectUri:@&&
wbApiCls:[WeiboApi class]];
//添加QQ空间应用 注册网址
/intro/login/
此处需要替换成自己应用的
[ShareSDK connectQZoneWithAppKey:@&&
appSecret:@&aed9be27bae87cd&
qqApiInterfaceCls:[QQApiInterface class]
tencentOAuthCls:[TencentOAuth class]];
//此参数为申请的微信AppID
此处需要替换成自己应用的
[ShareSDK connectWeChatWithAppId:@&wxf87885& wechatCls:[WXApi class]];
//添加QQ应用 该参数填入申请的QQ AppId
此处需要替换成自己应用的
[ShareSDK connectQQWithQZoneAppKey:@&&
qqApiInterfaceCls:[QQApiInterface class]
tencentOAuthCls:[TencentOAuth class]];&/span&
return YES;
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background t here you can undo many of the changes made on entering the background.
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
&span style=&color:#ff6600;&&#pragma mark - WX回调
- (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];
#pragma mark - WXApiDelegate
/*! @brief 收到一个来自微信的请求,第三方应用程序处理完后调用sendResp向微信发送结果
* 收到一个来自微信的请求,异步处理完成后必须调用sendResp发送处理结果给微信。
* 可能收到的请求有GetMessageFromWXReq、ShowMessageFromWXReq等。
* @param req 具体请求内容,是自动释放的
-(void) onReq:(BaseReq*)req{
/*! @brief 发送一个sendReq后,收到微信的回应
* 收到一个来自微信的处理结果。调用一次sendReq后会收到onResp。
* 可能收到的处理结果有SendMessageToWXResp、SendAuthResp等。
* @param resp具体的回应内容,是自动释放的
-(void) onResp:(BaseResp*)resp{
(4)信息分享。
-(IBAction)share:(id)sender{
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@&card&
ofType:@&png&];
//构造分享内容
id&ISSContent& publishContent = [ShareSDK content:@&分享内容测试&
defaultContent:@&默认分享内容测试,没内容时显示&
image:[ShareSDK imageWithPath:imagePath]
title:@&pmmq&
description:@&这是一条测试信息&
mediaType:SSPublishContentMediaTypeNews];
[ShareSDK showShareActionSheet:nil
shareList:nil
content:publishContent
statusBarTips:YES
authOptions:nil
shareOptions: nil
result:^(ShareType type, SSResponseState state, id&ISSPlatformShareInfo& statusInfo, id&ICMErrorInfo& error, BOOL end) {
if (state == SSResponseStateSuccess)
NSLog(@&分享成功&);
else if (state == SSResponseStateFail)
NSLog(@&分享失败&);
(5)登录、登出、获取授权信息、关注制定微博
LoginViewController.m
ShareSDKTest
Created by wangdalei on 14-6-23.
Copyright (c) 2014年 王大雷. All rights reserved.
#import &LoginViewController.h&
#import &ShareSDK/ShareSDK.h&
@interface LoginViewController ()
-(IBAction)loginWithSina:(id)
-(IBAction)loginWithQQ:(id)
-(IBAction)loginoutWithSina:(id)
-(IBAction)loginoutWithQQ:(id)
-(IBAction)guanzhuUs:(id)
-(void)reloadStateWithType:(ShareType)
@implementation LoginViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
- (void)viewDidLoad {
[super viewDidLoad];
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
- (IBAction)loginWithSina:(id)sender {
[ShareSDK getUserInfoWithType:ShareTypeSinaWeibo authOptions:nil result:^(BOOL result, id&ISSPlatformUser& userInfo, id&ICMErrorInfo& error) {
NSLog(@&%d&,result);
if (result) {
//成功登录后,判断该用户的ID是否在自己的数据库中。
//如果有直接登录,没有就将该用户的ID和相关资料在数据库中创建新用户。
[self reloadStateWithType:ShareTypeSinaWeibo];
-(IBAction)loginWithQQ:(id)sender{
[ShareSDK getUserInfoWithType:ShareTypeQQSpace authOptions:nil result:^(BOOL result, id&ISSPlatformUser& userInfo, id&ICMErrorInfo& error) {
NSLog(@&%d&,result);
if (result) {
//成功登录后,判断该用户的ID是否在自己的数据库中。
//如果有直接登录,没有就将该用户的ID和相关资料在数据库中创建新用户。
[self reloadStateWithType:ShareTypeQQSpace];
-(IBAction)loginoutWithSina:(id)sender{
[ShareSDK cancelAuthWithType:ShareTypeSinaWeibo];
[self reloadStateWithType:ShareTypeSinaWeibo];
-(IBAction)loginoutWithQQ:(id)sender{
[ShareSDK cancelAuthWithType:ShareTypeQQSpace];
[self reloadStateWithType:ShareTypeQQSpace];
-(void)reloadStateWithType:(ShareType)type{
//现实授权信息,包括授权ID、授权有效期等。
//此处可以在用户进入应用的时候直接调用,如授权信息不为空且不过期可帮用户自动实现登录。
id&ISSPlatformCredential& credential = [ShareSDK getCredentialWithType:type];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@&TEXT_TIPS&, @&提示&)
message:[NSString stringWithFormat:
@&uid = %@\ntoken = %@\nsecret = %@\n expired = %@\nextInfo = %@&,
[credential uid],
[credential token],
[credential secret],
[credential expired],
[credential extInfo]]
delegate:nil
cancelButtonTitle:NSLocalizedString(@&TEXT_KNOW&, @&知道了&)
otherButtonTitles:nil];
[alertView show];
//关注用户
-(IBAction)guanzhuUs:(id)sender{
[ShareSDK followUserWithType:ShareTypeSinaWeibo
//平台类型
field:@&ShareSDK&
//关注用户的名称或ID
fieldType:SSUserFieldTypeName
//字段类型,用于指定第二个参数是名称还是ID
authOptions:nil
//授权选项
viewDelegate:nil
//授权视图委托
result:^(SSResponseState state, id&ISSPlatformUser& userInfo, id&ICMErrorInfo& error) {
if (state == SSResponseStateSuccess) {
NSLog(@&关注成功&);
} else if (state == SSResponseStateFail) {
NSLog(@&%@&, [NSString stringWithFormat:@&关注失败:%@&, error.errorDescription]);
(5)你可能会看到一些应用需要第三方登录的,一种是弹出webView加载的新浪微博或者qq的网页授权,还有一种是跳转到本地的已经安装的新浪微博应用或者qq应用进行授权。第二种授权方式较SSO授权,体验会比较好一些,因为不需要用户输入新浪微博或QQ的用户名与密码。
第二种授权方式需要在plist中配置Scheme。SSO默认是打开的不需要配置。在AppDelegate中实现回调。
(6)测试DEMO截图:
DEMO下载地址:http://download.csdn.net/download/daleiwang/7734321
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:280059次
积分:2107
积分:2107
排名:第13851名
原创:44篇
转载:22篇
评论:56条
(1)(5)(8)(2)(2)(1)(2)(1)(7)(2)(2)(9)(9)(1)(1)(3)(1)(2)(4)(4)查看详情>>
查看详情>>
01:00 - 02:00
01:00 - 02:00
在艾泽拉斯,只有那些经验丰富的勇士才有足够的勇气与坚毅,挥动传奇神器迎战燃烧军团。随着你的力量不断提升,这些由神秘力量铸就的武器也会不断变强。你所做出的每一个选择都会影响到它的力量、外形、声音、及战斗中的手感。不断地改进你的神器,让它成为战场上最合手的兵刃,在最绝望的时刻指引你所在的阵营前行吧。Icovia,小白可用的专业室内布局设计软件 - 第611页/共888页 - 动点科技
又到了一年一度的 3·15。每年这个时候大家除了坐在电视机前,等待今年央视会曝光什么东西之外,不禁也会想想自己在实际生活当中消费的时候,会遭遇什么样的陷阱,以及用什么样的措施去应对。
现在很多人已经在网上购物,包括衣食住行等方面都大量地运用网络来解决。即使是在实体店购物也可以使用一些技术手段,来辅助自己作出更精明的选择。不过我们本期的 3·15 主题,则是献给家中的长辈,希望现在正在我们当中流行的工具,可以帮助家人的日常消费决策更加精明。
的消息,阿里巴巴有可能最早在今年四月份提交在美股上市的文件。
12 月份我们曾经
,这个视频解决方案已经吸引了一些媒体巨头的注意,他们和特纳广播公司(CNN 母公司)的合作,在他们参加了为期 12 个星期的特纳媒体训练营之后开始,现在已经富有成果,让他们可以在推特上官方嵌入自己的视频。
韩国高等科技学院(KAIST)的研究人员开发了一种头戴式显示器,图像处理和显示的速度比谷歌眼镜要快上 30 倍。学院 的电子工程学教授柳海俊(Yoo Hoi-Jun)和其团队开发的韩国版眼镜“K-Glass”具有高强的性能,头戴式显示植入一个虚拟显示芯片,比现有谷歌眼镜的运行时间长 3-12 倍,运行速度则快上 30 倍。
每日风险投资速递(3 月 13 日,IT 桔子收录 8 起投资/收购事件)
2 月 17 日韩国聊天软件开发商 Kakao 宣布,他们已经将流行的消息应用 KakaoTalk 内置在诺基亚的低端非智能机型 Nokia Asha 中。
这次跨平台合作首先将让新加坡,印度和泰国的用户受益
TechNode TV
乐视 Cool1 dual 手机上手评测
开启微信,扫一扫
如果你的产品足够锐意创新,欢迎
输入您的邮箱地址:
开启微信,扫一扫

我要回帖

更多关于 sharesdk是什么文件夹 的文章

 

随机推荐