ShareManager 0.4.0

ShareManager 0.4.0

测试已测试
语言语言 Objective-CObjective C
许可 MIT
发布日期最后发布2015年12月

Jerry Baocmginex维护。



 
依赖项
BlocksKit~> 2.2.5
MBProgressHUD~> 0.9.1
OAuthConsumer~> 1.0.3
 

  • 作者
  • Jerry

一款iOS SNS(社交网络服务)分享管理器,支持Instagram、Facebook、Twitter、微博、QQ和微信。

支持单次和批量分享到社交平台。

预览

Drawing Drawing

如何集成到项目中

  1. 系统要求

    iOS 7或更高版本

  2. 通过cocoapods安装

    pod 'ShareManager'
    
  3. AppDelegate中添加以下代码(请记住将分享平台的app key、secret、redirect uri替换为您的)

    #import "ShareManager.h"
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
    
        [self initSharePlatform];
    
        return YES;
    }
    
    - (void)initSharePlatform
    {
    #warning Replace the share platforms app key, secret and redirect uri to yours
    
        [[ShareManager sharedManager] initTencentQQWithAppKey:@"kQzoneKey" appSecret:@"kQzoneSecret"];
        [[ShareManager sharedManager] initWexinWithAppKey:@"kWeixinAppKey" appSecret:@"kWeixinAppSecret"];
        [[ShareManager sharedManager] initWeiboWithAppKey:@"kWeiboAppKey" appSecret:@"kWeiboSecret" redirectUri:@"kWeiboRedirectUri"];
        [[ShareManager sharedManager] initTwitterWithAppKey:@"kTwitterAppKey" appSecret:@"kTwitterAppSecret" redirectUri:@"kTwitterRedirectUri"];
        [[ShareManager sharedManager] initFacebookWithAppKey:@"kFacebookAppKey" appSecret:@"kFacebookAppSecret" redirectUri:@"kFacebookRedirectUri"];
        [[ShareManager sharedManager] initInstagram];
    }
    
    - (BOOL)application:(UIApplication *)application  handleOpenURL:(NSURL *)url
    {
        return [[ShareManager sharedManager] handleOpenURL:url];
    }
    
    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
    {
        return [[ShareManager sharedManager] handleOpenURL:url];
    }
  4. 将URL Schemes添加到Info.plist

    参考示例的Info.plist

使用方法

  1. 单次分享

    NSString *sTitle = @"Your QQ or Weixin share title"; //Only support QQ and Weixin 
    NSString *sDesc = @"Your share content";
    NSString *sUrl = @"https://#";
    SMImage *sImage = [[SMImage alloc] initWithImageUrl:@"http://e.hiphotos.baidu.com/image/w%3D310/sign=af410cc1f536afc30e0c39648319eb85/6f061d950a7b0208d7fa7ee060d9f2d3572cc884.jpg"];
    
    [[ShareManager sharedManager] setContentWithTitle:sTitle description:sDesc image:sImage url:sUrl];
    [[ShareManager sharedManager] showShareWindow];
  2. 批量分享

    NSString *sTitle = @"Your QQ or Weixin share title"; //Only support QQ and Weixin 
    NSString *sDesc = @"Your share content";
    NSString *sUrl = @"https://#";
    SMImage *sImage = [[SMImage alloc] initWithImageUrl:@"http://e.hiphotos.baidu.com/image/w%3D310/sign=af410cc1f536afc30e0c39648319eb85/6f061d950a7b0208d7fa7ee060d9f2d3572cc884.jpg"];
    NSMutableArray *shareList = [NSMutableArray arrayWithArray:@[@(SMPlatformWeiboOAuth), @(SMPlatformTencentQQ), @(SMPlatformWeixin), @(SMPlatformFacebookOAuth), @(SMPlatformTwitterOAuth)]];
    
    [[ShareManager sharedManager] setContentWithTitle:sTitle description:sDesc image:sImage url:sUrl];
    [[ShareManager sharedManager] batchShareWithShareList:shareList];

    处理分享结果

    使用ShareManagerDelegate

    - (void)showShareResult:(SMShareResult *)result;
    

    参考示例的ViewController.m文件

问题

有任何问题可以通过以下邮箱联系我:[email protected]

许可

MIT许可(MIT)

版权所有(c) 2015 Jerry Bao

任何人有权免费获得此软件及其相关文档文件的副本(以下简称“软件”),没有任何限制地处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售副本,并允许软件提供者使用软件,前提是以下条件

上述版权声明和本许可声明应包含在软件的所有副本或实质性部分的副本中。

本软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于适销性、适用于特定用途和非侵犯性的保证。在任何情况下,作者或版权所有者不对任何索赔、损害或其他责任承担责任,无论是基于合同、侵权或其他方式引起的,包括但不限于软件的使用或与其他软件一起使用的后果。