使用cocoapods"use_frameworks!"时出错 迅速

cmi*_*mii 18 ios cocoapods swift residemenu

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

gem install cocoapods
Run Code Online (Sandbox Code Playgroud)

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

pod install
Run Code Online (Sandbox Code Playgroud)

由于这个错误:

[!] 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.
Run Code Online (Sandbox Code Playgroud)

我更新了我的podfile,添加了"use_frameworks!"

我的podfile现在是:

# 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
Run Code Online (Sandbox Code Playgroud)

因为,我构建时有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
Run Code Online (Sandbox Code Playgroud)

在我的构建设置中,我有:

构建设置

我认为这是因为"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'
Run Code Online (Sandbox Code Playgroud)

小智 16

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

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