gpt4 book ai didi

ios - InstagramKit 集成到 swift 项目中

转载 作者:可可西里 更新时间:2023-11-01 00:37:37 26 4
gpt4 key购买 nike

如标题所示,我需要在新的 swift 项目中使用 InstagramKit (3.5.0) pod(用 objective-c 编写)。

所以我安装 pod(pod 安装),然后创建我的 InstagramSwift-Bridging-Header.h 和添加导入库:

 #import <InstagramKit/InstagramEngine.h>

然后,只要构建这个空项目,我就会得到:

/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h:5:9:

注意:在包含的文件中

/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h:5: 
-(BOOL)application:(UIApplication *)application
^ <unknown>:0:

错误:导入桥接头失败

'/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h' 

预期类型导入桥接头失败

'/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h'

我会错过什么?

enter image description here

最佳答案

在与@eric-d 进行了大量讨论之后,我可能在我的 podfile 中发现了问题:

target "InstagramSwift" do 

pod 'InstagramKit', '3.5.0'

end

所以我删除了项目并使用 Podfile 从一个空项目重新开始:

use_frameworks!
platform :ios, '8.0'
pod 'AFNetworking', '~> 2.5'
pod 'InstagramKit', '3.5.0'

然后我手动创建了 SwitBridge.h 并将其链接到build设置中。

最后,我可以在任何 swift 文件中使用 instagramKit 模块,例如:

import InstagramKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
let instagramEngine: InstagramEngine = InstagramEngine.sharedEngine()
}

}

问题可能是缺少平台设置。

编辑

此外,

"use_frameworks!"

感谢this answer .

关于ios - InstagramKit 集成到 swift 项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30193402/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com