【问题标题】:When trying to use cocoapods with swift getting error: bridging header does not exist?当尝试使用可可豆时迅速出现错误:桥接头不存在?
【发布时间】:2016-01-09 04:19:55
【问题描述】:

我正在尝试使用this ExpandingTableView pod。当我尝试在我的项目Expense 中使用它时,它不起作用,所以我查看了this Stackoverflow post 并遵循了linked tutorial. 但现在我收到了一个错误:

error: bridging header '/Users/Monica/Documents/CS 4999/Project/Expense/Expense/Expense-Bridging-Header.h' does not exist

作为教程的一部分,您应该进入项目的构建设置并将密钥 Objective-C Bridging Header 编辑为 project_name/project_name-Bridging-Header.h(在我的例子中:Expense/Expense-Bridging-Header.h)。这就是我所做的as you can see

为了修复此错误,我将密钥 Objective-C Bridging HeaderExpense/Expense-Bridging-Header.h 编辑为 Expense/Header.hExpense-Bridging-Header.hBridging.h./Expense/Bridging.h./Expense/Expense-Bridging-Header.h。没有解决这个错误。

如果有人能告诉我为什么会发生这种情况以及如何解决这个问题,我们将不胜感激!


This is how the files in my project Expense are arranged in Xcode.

These are the files of ExpandingTableView pod in Xcode.

This is where Bridging.h is located on my computer.

我的播客文件:

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'Expense' do
pod 'ExpandingTableView'
end

target 'ExpenseTests' do

end

target 'ExpenseUITests' do

end

【问题讨论】:

    标签: ios objective-c xcode swift cocoapods


    【解决方案1】:

    如果您使用的是框架,则不再需要桥接头。相反,您将直接在 swift 文件中导入框架,您将在其中使用它,如下所示:

    import ExpandingTableView
    
    class MyTableView: UITableViewController{}
    

    【讨论】:

    • 哇,我期待一个更复杂的密集解决方案,但这就是如此简单!谢谢!
    • 没问题,不久前我不得不自己解决这个问题!
    猜你喜欢
    • 2017-01-20
    • 2019-11-27
    • 1970-01-01
    • 1970-01-01
    • 2016-10-14
    • 2021-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多