本文介绍: 手动集成Tencent SDK遇到的坑!!!

手动集成原因

由于腾讯未把Tencent SDK上传到Github中,所以我们不能通过Cocoapods方式集成,只能通过官方下载其SDK手动集成

Tencent SDK手动集成步骤

1.访问腾讯开放平台SDK下载界面,找到并下载iOS_SDK_V3.5.1。(目前最新

2.解压压缩包,会看到TencentOpenApi(Lite)_3文件夹里面两个文件(TencentOpenApi_IOS_Bundle.bundle、TencentOpenAPI.framework)就是我们集成进行的;

3.将以上两个文件导入项目中,如图所示

导入TencentOpenAPI框架

4.项目添加QQ白名单(把以下schemes添加项目info.plist,以源码的方式打开即可):

<key&gt;LSApplicationQueriesSchemes</key&gt;
<array>
<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>mqqopensdkapiV4</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>
</array>

5.添加URL Type,登录腾讯开放平台获取已经注册好的应用ID,来注册URL Schemes,为tencent+APP ID

6.在腾讯开放平台验证Universal Link。(举例:https://m.mojidict.com/qq_conn/APPID,这一步很重要,涉及到跳转第三方APP事件

7.导入依赖框架

Foundation.framework
UIKit.framework
libc++.tbd
libsqlite3.tbd
Security.framework
libz.tbd
libiconv.tbd
CoreTelephony.framework
CoreGraphics.framework
SystemConfiguration.framework
libz.1.1.3.tbd

8.最后编译运行项目,Xcode报错。So easy的感觉,看似集成成功了!

 

但是…

导入以下框架初始化SDK时,

#import <TencentOpenAPI/TencentOAuth.h>
#import <TencentOpenAPI/QQApiInterface.h>

[[TencentOAuth alloc] initWithAppId:MOJiQQAppID andUniversalLink:MOJiQQAppUniversalLink delegate:self];

报错如图所示

 

 

 

网上查了各种资料都不好使!!!!真的,什么都查过了。试了,还是无解!

突然想到腾讯技术客服…要不问问???

我TM放弃了!!

腾讯没有客服啊…

后面尝试运行官方提供的demo编译可以通过的。但是为什么这里创建项目就不好使了呢??

一度怀疑人生…

此时经过一番折腾…

然后直盯盯地看着这些错误警告,不知怎滴,突然发现

上面几张图中,其中错误1、错误3,这两张图,反馈错误是不能构建模块TencentOpenApi,奇怪了,为什么腾讯的SDK开放我们头文件,会有如下导入操作

#import "sdkdef.h"
#import "QQApiInterfaceObject.h"

注意,我们自定义框架时候,都会有这么一段话:

// In this header, you should import all the public headers of your framework using statements like #import <XXX/PublicHeader.h>

然后外部使用头文件中,也需要以这这种方式导入头文件,这时候找到对应头文件手动分别修改为:


#import <TencentOpenAPI/sdkdef.h>
#import <TencentOpenAPI/QQApiInterfaceObject.h>

 

修改后图示:

把#import “sdkdef.h”改为#import <TencentOpenAPI/sdkdef.h>

把#import “QQApiInterfaceObject.h”改为#import <TencentOpenAPI/QQApiInterfaceObject.h>

继续步骤8…

9.再次编译运行项目,成功!!!(没办法,只能手动框架里面修改了)

总结

1.腾讯的SDK文档老旧,很多操作步骤都是多余的,不建议大家看,直接看这里即可;
坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

原文地址:https://blog.csdn.net/ochenmengo/article/details/129409092

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_25452.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注