Latest 0.3.0
Homepage https://github.com/wangyansnow/WYShareSDK
License MIT
Platforms ios 7.0, requires ARC
Frameworks ImageIO, SystemConfiguration, CoreText, QuartzCore, Security, UIKit, Foundation, CoreGraphics, CoreTelephony
Authors

WYShareSDK.png

1.项目环境搭建

[1]将ShareSDK文件夹中的文件拖入到项目中

ShareSDK_file.png

[2]链接所需的系统库

1.  CoreText.framework
2.  ImageIO.framework
3.  QuartzCore.framework
4.  CoreGraphics.framework
5.  Security.framework
6.  SystemConfiguration.framework
7.  CoreTelephony.framework
8.  libsqlite3.0.tbd
9.  libsqlite3.tbd
10. libstdc++.tbd
11. libiconv.tbd
12. libiconv.tbd
13. libz.tbd
14. libc++.tbd

Paste_Image.png

[3]在Xcode中,选择你的工程设置项,选中TARGETS一栏,在info标签栏的URL type添加URL scheme 为你在各大平台所注册应用程序的id (如下图所示)

URLScheme.png

[4]针对iOS9的适配.右击项目中的info.plist,然后用Open as -> Source Code的方式打开,增加如下代码:

<key>LSApplicationQueriesSchemes</key>
 <array>
  <string>wechat</string>
  <string>weixin</string>
  <string>sinaweibohd</string>
  <string>sinaweibo</string>
  <string>sinaweibosso</string>
  <string>weibosdk</string>
  <string>weibosdk2.5</string>
  <string>mqqapi</string>
  <string>mqq</string>
  <string>mqqOpensdkSSoLogin</string>
  <string>mqqconnect</string>
  <string>mqqopensdkdataline</string>
  <string>mqqopensdkgrouptribeshare</string>
  <string>mqqopensdkfriend</string>
  <string>mqqopensdkapi</string>
  <string>mqqopensdkapiV2</string>
  <string>mqqopensdkapiV3</string>
  <string>mqzoneopensdk</string>
  <string>wtloginmqq</string>
  <string>wtloginmqq2</string>
  <string>mqqwpa</string>
  <string>mqzone</string>
  <string>mqzonev2</string>
  <string>mqzoneshare</string>
  <string>wtloginqzone</string>
  <string>mqzonewx</string>
  <string>mqzoneopensdkapiV2</string>
  <string>mqzoneopensdkapi19</string>
  <string>mqzoneopensdkapi</string>
  <string>mqzoneopensdk</string>
 </array>
<!--  让iOS9 退回到以前可以支持http请求  -->
 <key>NSAppTransportSecurity</key>
 <dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
 </dict>

[5]选中项目设置,在Build Settings中的Other Linker Flags中增加-fobj-arc-ObjC

Paste_Image.png
这时编译一下你的项目,如果没有报错,恭喜你环境搭建成功

2.分享的代码使用

AppDelegate中注册 微信/QQ/和微博

#import "AppDelegate.h"
#import "WYShareSDK.h"

/** 在三大平台注册的应用ID */
#define WXAppId    @"wx7074076f395c69d9"
#define QQAppId    @"1103515189"
#define WBAppKey    @"2273722657"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [WYShareSDK registerQQApp:QQAppId];
    [WYShareSDK registerWeiboApp:WBAppKey];
    [WYShareSDK registerWeChatApp:WXAppId];
    
    return YES;
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
    
    return [WYShareSDK handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    
    return [WYShareSDK handleOpenURL:url];
}

@end

在需要分享的地方直接导入WYShareSDK.h,调用其对应的方法分享到各个平台.例:

[WYShareSDK weChatShareText:@"分享一个" finished:^(WYShareResponse *response) {
        if (response.isSucess) {
            NSLog(@"分享成功");
            return;
        }
        NSLog(@"分享失败 error = %@", response.errorStr);
    }];

Latest podspec

{
    "name": "WYShareSDK",
    "authors": {
        "wangyansnow": "[email protected]"
    },
    "version": "0.3.0",
    "summary": "u4e09u5927u5e73u53f0u767bu5f55u548cu5206u4eab",
    "description": "qq, u5faeu4fe1uff0c u5faeu535au5206u4eabu4ee5u53cau9664u4e86u5faeu535au7684u767bu5f55,u53efu4ee5u9009u62e9u4f60u60f3u8981u7684u5e73u53f0u8fdbu884cu96c6u6210",
    "homepage": "https://github.com/wangyansnow/WYShareSDK",
    "source": {
        "git": "https://github.com/wangyansnow/WYShareSDK.git",
        "tag": "0.3.0",
        "submodules": true
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "license": "MIT",
    "source_files": "ShareSDK/Core/*.{h,m}",
    "frameworks": [
        "ImageIO",
        "SystemConfiguration",
        "CoreText",
        "QuartzCore",
        "Security",
        "UIKit",
        "Foundation",
        "CoreGraphics",
        "CoreTelephony"
    ],
    "libraries": [
        "sqlite3",
        "z",
        "c++",
        "iconv",
        "stdc++",
        "sqlite3.0"
    ],
    "subspecs": [
        {
            "name": "QQSDK",
            "source_files": "ShareSDK/QQModel/*.{h,m}",
            "resources": "ShareSDK/QQSDK/TencentOpenApi_IOS_Bundle.bundle",
            "vendored_frameworks": "ShareSDK/QQSDK/TencentOpenAPI.framework",
            "dependencies": {
                "WYShareSDK/Core": []
            }
        },
        {
            "name": "WXSDK",
            "source_files": [
                "ShareSDK/WXSDK/*.{h,m}",
                "ShareSDK/WXModel/*.{h,m}"
            ],
            "vendored_libraries": "ShareSDK/WXSDK/libWeChatSDK.a",
            "dependencies": {
                "WYShareSDK/Core": []
            }
        },
        {
            "name": "WeiboSDK",
            "source_files": [
                "ShareSDK/libWeiboSDK/*.{h,m}",
                "ShareSDK/WeiboModel/*.{h,m}"
            ],
            "resources": "ShareSDK/libWeiboSDK/WeiboSDK.bundle",
            "vendored_libraries": "ShareSDK/libWeiboSDK/libWeiboSDK.a",
            "dependencies": {
                "WYShareSDK/Core": []
            }
        },
        {
            "name": "Core",
            "source_files": "ShareSDK/Core/*.{h,m}"
        }
    ]
}

Pin It on Pinterest

Share This