Latest 0.1.1
Homepage https://github.com/snaill/ShareOne
License MIT
Platforms ios 8.0, requires ARC
Frameworks Security, CoreTelephony, SystemConfiguration, CoreGraphics
Authors

CI Status
Version
License
Platform

ShareOne是一款用于分享到微信/QQ的库,相对于已有的分享库,ShareOne的特点是

  • 采用自定义UIActivity
  • 接口简单

注:分享到微信的代码来源于WeixinActivity,本来ShareOne是依赖于WeixinActivity,但由于XCode 7增加BITCODE的设置,而WxApi和QQ API都没有跟随更新,导致部署时编译错误。在WeixinActivity未更新前,暂时将代码并入ShareOne中,以方便使用。

Installation

pod "ShareOne"
  • 在AppDelegate.m中注册APP ID
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [ShareOne registerWX:@"wx11111"];
    [ShareOne registerQQ:@"22222"];
  • 此外,您还需要调用handle函数
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    return [ShareOne handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    return [ShareOne handleOpenURL:url];
}
  • 调用UIActivityViewController实现分享
NSArray * activity = [ShareOne activitysWithTypes:@[@(ShareOneTypeWeixin), @(ShareOneTypeWeixinTimeline), @(ShareOneTypeQQ), @(ShareOneTypeQZone)]];

NSMutableArray * activityItems = @[title, image, url];    
UIActivityViewController *activityView = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:activity];
[self presentViewController:activityView animated:YES completion:nil];

Requirements

  • iOS 8
  • ARC

License

ShareOne is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ShareOne",
    "version": "0.1.1",
    "summary": "u5faeu4fe1QQu5206u4eabu5e93",
    "homepage": "https://github.com/snaill/ShareOne",
    "license": "MIT",
    "authors": {
        "snaill": "[email protected]"
    },
    "source": {
        "git": "https://github.com/snaill/ShareOne.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "pod_target_xcconfig": {
        "ENABLE_BITCODE": "NO"
    },
    "source_files": [
        "Pod/Classes/**/*.{h,m}",
        "Pod/SDK/WeChatSDK_1.5/**/*.h"
    ],
    "resources": "Pod/Assets/*.png",
    "public_header_files": "Pod/Classes/ShareOne.h",
    "vendored_frameworks": "Pod/SDK/TencentOpenAPI-2.9.0-min/TencentOpenAPI.framework",
    "vendored_libraries": "Pod/SDK/WeChatSDK_1.5/libWeChatSDK.a",
    "frameworks": [
        "Security",
        "CoreTelephony",
        "SystemConfiguration",
        "CoreGraphics"
    ],
    "libraries": [
        "z",
        "sqlite3",
        "iconv",
        "stdc++"
    ]
}

Pin It on Pinterest

Share This