ios - 使用 cocoapods 时出错 "use_frameworks!"SWIFT

标签 ios swift cocoapods residemenu

我有一个干净的 swift 项目,使用了一些 cocoapods:Parse、AFNetworking 和 RESideMenu。 我需要使用 STZPopupView pod,所以我用最新版本更新了 cocoapods:

gem install cocoapods

然后我为我的项目重新启动它:

pod install

因为这个错误:

[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt into using it.

我更新了我的 podfile 添加“use_frameworks!”

我的播客文件现在是:

# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'

target 'isam' do
pod 'RESideMenu', '~> 4.0.7'
pod 'AFNetworking', '~> 2.5'
pod 'Parse', '~> 1.6'
pod 'STZPopupView', '~> 1.0'
end

target 'isamTests' do

end

因为,我在构建时遇到了 2 个错误:

  • 未找到“RESideMenu.h”文件
  • 无法导入桥接头“..../isam/Swift-Bridging-Header.h”

我没有更改项目中的任何其他内容。

我的 Swift-Bridging-Header.h 没有改变:

#ifndef isam_Swift_Bridging_Header_h
#define isam_Swift_Bridging_Header_h

#import <Parse/Parse.h>
#import <RESideMenu.h>

#endif

在我的build设置中,我有:

builds settings

我认为这是因为“use_frameworks!”在我的 podfile 中,但我不知道如何使用我的所有 pod 来正确构建我的应用程序。

编辑:

确切的错误是:

/path_of_my_project/Swift-Bridging-Header.h:12:9: error: 'RESideMenu.h' file not found
#import <RESideMenu.h>
        ^
<unknown>:0: error: failed to import bridging header '/path_of_my_project/Swift-Bridging-Header.h'

最佳答案

其实我也遇到了同样的问题。你可以试试这个:http://www.innerexception.com/2015/05/cocoapods-useframeworks-means-bridging.html

使用 use_frameworks 时!在 CocoaPods 中,您所有的 pod 都将用作框架,而不仅仅是 swift pod。所以你不需要桥接头。只需将您的 pod 导入到您需要的所有 swift 文件中。 在您的示例中,您必须编写: 导入 RESideMenu

关于ios - 使用 cocoapods 时出错 "use_frameworks!"SWIFT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31278833/

相关文章:

ios - UITableView 在模拟器 iOS 7.0 中正确呈现,但不适用于 iOS 6.1

ios - 使用 faSTLane 部署后从 hockey 获取下载 url

ios - 只显示我的 float 到某个小数位 - Swift

swift - 理解为什么 swift 代码不能正常工作

ios - Cocoapod 的 'pod install' 使用 Prefix Header 会产生奇怪的行为

ios - 如何进行 Cocoapods 安装?

UIView 中的 iOS UIScrollView

ios - UIPanGestureRecognizer 为什么以及如何使 UISwipeGestureRecognizer 静音,而 UITapGestureRecognizers 默认情况下不会相互静音?

ios - 当嵌入 View 尺寸改变时,如何用动画改变容器 View 尺寸?

ios - 不同iOS版本的cocoapods