我有一个干净的swift项目,使用了一些cocoapods : Parse、AFNetworking和RESideMenu。我需要使用cocoapods,所以我用最新版本更新了STZPopupView:
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.
我更新了我的播客文件,添加了"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
因为,我在构建时有两个错误:
找不到
在我的项目中,我没有改变任何其他东西。
我的Swift-Bridging-Header.h没有改变:
#ifndef isam_Swift_Bridging_Header_h
#define isam_Swift_Bridging_Header_h
#import <Parse/Parse.h>
#import <RESideMenu.h>
#endif
在我的构建设置中,我有:
我想是因为"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'
发布于 2015-07-15 15:32:51
实际上我也有同样的问题。你可以试试这个:http://www.innerexception.com/2015/05/cocoapods-useframeworks-means-bridging.html
当使用use_frameworks时!在CocoaPods中,您所有的pods都将用作框架,而不仅仅是swift pods。因此,您不需要为此提供桥接头。只需将您的pod导入到您需要的所有swift文件中。在您的示例中,您必须这样写:导入RESideMenu
发布于 2015-07-08 04:57:37
尝试从Objective-C桥接头中删除isam/,并且只有Swift- Bridging -Header.h
根据个人经验,CocoaPods在结合swift和Objective C框架时仍然存在一些问题。你可以使用Alamofire,它几乎等同于swift的AFNetworking。
希望这能有所帮助。
编辑:当你可以直接使用swift库时,为什么要在swift中使用Objectice呢?
发布于 2016-02-13 00:37:09
我也有同样的问题。例如,我将所有的导入从#import "RESideMenu.h"
更改为#import <RESideMenu/RESideMenu.h>
。
https://stackoverflow.com/questions/31278833
复制相似问题