date: 2018-12-13 11:38:00
1.0.6 support DingTalk & Telegram
LDSDKManager_IOS
主要聚合QQ、微信、微博、支付寶等第三方庫,抽象封裝分享、授權、支付功能,以便其他開發者能快速接入。
整合方式
pod 'LDSDKManager'
複製程式碼
整合步驟
1.註冊第三方keys
NSArray *regPlatformConfigList = @[
@{
LDSDKConfigAppIdKey:@"微信appid",
LDSDKConfigAppSecretKey:@"微信appsecret",
LDSDKConfigAppDescriptionKey:@"應用描述",
LDSDKConfigAppPlatformTypeKey:@(LDSDKPlatformWeChat)
},
@{
LDSDKConfigAppIdKey:@"QQ appid",
LDSDKConfigAppSecretKey:@"qq appkey",
LDSDKConfigAppPlatformTypeKey:@(LDSDKPlatformQQ)
},
@{
LDSDKConfigAppIdKey:@"易信appid",
LDSDKConfigAppSecretKey:@"易信appsecret",
LDSDKConfigAppPlatformTypeKey:@(LDSDKPlatformYiXin)
},
@{
LDSDKConfigAppSchemeKey:@"支付寶 appScheme",
LDSDKConfigAppPlatformTypeKey:@(LDSDKPlatformAliPay)
},
];
[[LDSDKManager share] registerWithPlatformConfigList:regPlatformConfigList];
複製程式碼
2.在Appdelegate中
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
BOOL success = [[LDSDKManager share] handleURL:url];
return success;
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
BOOL success = [[LDSDKManager share] handleURL:url];
return success;
}
複製程式碼
3.分享能力和授權能力
請參照LDSDKManager-SDK-Example &
複製程式碼
4.其他配置
4.1 info.plist add schemes
<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>mqqbrowser</string>
<string>mttbrowser</string>
<string>waquchild</string>
<string>tencentapi.qq.reqContent</string>
<string>tencentapi.qzone.reqContent</string>
</array>
複製程式碼
4.1 info.plist add URL types
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.poholo.MCShare</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mcshare</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>weixin</string>
<key>CFBundleURLSchemes</key>
<array>
<string>xxxxx</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>tencent</string>
<key>CFBundleURLSchemes</key>
<array>
<string>xxxxx</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>weibo</string>
<key>CFBundleURLSchemes</key>
<array>
<string>sina.xxxxxxxx</string>
</array>
</dict>
</array>
複製程式碼
LDSDKManager的框架層次
LDSDKManager目前有五個submodule,分別是CoreService,QQService,WechatService,AlipayService。後邊四個分別整合了QQSDK、微信SDK、支付寶SDK,他們都依賴於CoreService。
整合的優點在於:
-
開發者無需呼叫SDK標頭檔案,方便SDK的升級;
-
易擴充,可以通過增加模組使得開發者無需修改程式碼即可支援更多的第三方SDK。
如何新增一個第三方SDK
- 如果是已有的模組,匯入子模組即可;
- 如果要匯入新的SDK,實現步驟: SDKManager中LDSDKPlatformType新增相應type; 建立新資料夾,匯入SDK檔案,編寫程式碼實現SDKServiceInterface資料夾 中的protocol; 修改SDKServiceConfig.plist,新增新SDK支援的Service以及對應實現的檔名。
updates
1.0.4 更新依賴方式(pod版),支援最新的sdk
1.0.5 a.三方庫均用官方和poholo維護的三方庫
b.更新sdk,增加更多的分享型別,以及平臺特性。
c.授權-微博增加使用者資訊獲取
複製程式碼
Author
littleplayer mailjiancheng@163.com
License
LDSDKManager is available under the MIT license. See the LICENSE file for more info.