问题描述
我想在我的Objective-C应用程序中使用一些Swift Pod,所以我需要使用框架而不是静态库.但是在我的Podfile中启用use_frameworks!
会导致#import
错误提示音.
I want to use some Swift pods in my Objective-C app, so I need to use frameworks instead of static libraries. But enabling use_frameworks!
in my Podfile causes tones of #import
errors.
我的Podfile:
platform :ios, '8.0'
use_frameworks!
pod 'AFNetworking', '2.6.0'
pod 'Typhoon'
pod 'SSKeychain'
pod 'JBWebViewController'
pod 'TTTAttributedLabel'
pod 'HockeySDK'
pod 'GoogleAnalytics'
pod 'Intercom'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'UIButton+Activity'
pod 'HexColors'
pod 'AFNetworkActivityLogger'
pod 'HCSStarRatingView', :git => 'https://github.com/hsousa/HCSStarRatingView.git'
pod 'LGSideMenuController'
pod 'DateTools'
pod 'SDWebImage'
pod 'SSCWhatsAppActivity'
pod 'UIViewController+BlockSegue'
第一个问题是SSKeychain
吊舱:
在代码中,我使用引号" #import "SSKeychain/SSKeychain.h"
包括SSKeychain,但是如果我理解正确,我现在需要使用<angle>
吗?但是在这种情况下,我会在代码中收到相同的错误.
In code I'm including SSKeychain using "quotes" #import "SSKeychain/SSKeychain.h"
, but if I understand right, I need to use <angle>
from now #import <SSKeychain/SSKeychain.h>
? But in this case I receive same error, but in my code.
我的构建阶段:
无论如何,我发现带有引号"导入的SSKeychain的分支( https://github.com /adamwulf/sskeychain/commit/2b7fd878415e8e4f23f74636cdd8c993466d0749 )并切换到那些版本.
Anyway I have found fork of SSKeychain with "quotes" import (https://github.com/adamwulf/sskeychain/commit/2b7fd878415e8e4f23f74636cdd8c993466d0749) and switched to those version.
但是现在我对许多其他吊舱(几乎所有吊舱)都存在相同的问题:
But now I have same issue with many other pods (almost with all of them):
导入应用程序:#import "FBSDKCoreKit/FBSDKCoreKit.h"
我真的需要派生每个仓库并更改导入语句吗?还是我以错误的方式包含吊舱?
Do I really need to fork each repo and change import statements?? Or I'm including pods in wrong way?
PS:在每次构建尝试之前,我都会清理派生数据和项目.
PS: I'm cleaning derived data and project before each build attempt.
Cocoapods版本:0.39.0
Cocoapods Version: 0.39.0
推荐答案
在Podfile中使用模块 ,为什么不只是:
As you've used Modules in your Podfile, why don't you just:
@import SSKeychain;
代替:
#import <SSKeychain/SSKeychain.h>
要测试:
- 使用一个ViewController创建一个简单的iOS项目
- 使用上面的代码创建Podfile
- 运行pod安装
- 打开工作区
- 建立和建立运行:它编译正常
这篇关于Cocoapods use_frameworks!进口问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!