Code Monkey home page Code Monkey logo

xmsharemodule's Introduction

ReadMe

为了方便第三方开发者快速简单的集成国内三大社交平台(微信,QQ,微博),故造此轮子。

目前支持微信(微信好友,微信朋友圈),QQ,QQ空间,新浪微博)

关于此模块的Bug反馈、建议、口水等等,请大家狠拍并提交到Github上,我会尽快解决。

该模块会继续完善优化,争取为大家提供一个更快速、更简单、更规范、扩展性更好的集成模块。

=========== 图片

特点:

  • 快速
  • 简单
  • 易集成
  • 支持网页/SSO
  • 扩展性好
  • 可定制

===

集成步骤

1. 下载微信、QQ、微博的社交sdk并导入至项目中

  • 可在本页下方参考资料中取得

2. 导入它们所需的系统framework与库

程序 —— Targets —— Build Phases —— Link Binary With Libraries

Security.framework, SystemConfiguration.framework, CoreGraphics.framework, CoreTelephony.framework, QuartzCore.framework, ImageIO.framework, CoreText.framework, UIKit.framework, Foundation.framework, libsqlite3.dylib, libc++.dylib, libz.dylib, libstdc++.dylib, libiconv.dylib

  • (具体可参考本页底部参考资料链接)

3. 设置编译选项

程序 —— Targets —— Build Settings —— Linking —— Other Linker Flag 添加 -ObjC

4. 设置URL Schema

程序 —— Targets —— Info —— URL Types

分别添加微信,QQ,微博

tencentopenapi : tencent222222

mqqapi : QQ0605C97A

weibo : wb2045436852

weixin : wxd930ea5d5a258f4f

  • 以上均为测试app key,具体可以去对应的开放平台注册

  • mqqapi 是 tencent 的 app key 转十六进制,不足八位在前面补 0 的结果

5. 导入XMShareView至项目中

#####XMShareView结构介绍:

名称 解释
CommonMarco.h 通用宏文件,包含APP Key等宏
ExtView/ 扩展View,VerticalUIButton为图片文件垂直对齐按钮
Resource/ 图片等资源,包含微信、QQ、微博图标
ShareUtil/ 分享工具类
XMShareView.h 分享显示视图

6. 在AppDelegate.m中注册

  1. 导入文件头
#import "WXApi.h"
#import <TencentOpenAPI/TencentOAuth.h>
#import "WeiboSDK.h"
  1. application -> didFinishLaunchingWithOptions 方法中注册
[WXApi registerApp:APP_KEY_WEIXIN];
[WeiboSDK enableDebugMode:YES];
[WeiboSDK registerApp:APP_KEY_WEIBO];

7. 在ViewController.m 中引用

  • 导入文件头

     #import "XMShareView.h"
    
  • 添加一个属性

@property (nonatomic, strong) XMShareView *shareView;
  • 在点击分享的方法添加如下代码:
   if(!self.shareView){
        
        self.shareView = [[XMShareView alloc] initWithFrame:self.view.bounds];
        
        self.shareView.alpha = 0.0;

        self.shareView.shareTitle = NSLocalizedString(@"分享标题", nil);
        
        self.shareView.shareText = NSLocalizedString(@"分享内容", nil);
        
        self.shareView.shareUrl = @"http://xumeng.github.com";
        
        [self.view addSubview:self.shareView];
        
        [UIView animateWithDuration:1 animations:^{
            self.shareView.alpha = 1.0;
        }];
        
        
    }else{
        [UIView animateWithDuration:1 animations:^{
            self.shareView.alpha = 1.0;
        }];
        
    }

参考资料

QQ iOS SDK 环境搭建

新浪微博 iOS SDK 环境搭建

微信 iOS SDK 环境搭建

xmsharemodule's People

Contributors

xumeng avatar

Watchers

James Cloos avatar Zike Xiong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.