【发布时间】:2017-03-25 04:57:42
【问题描述】:
我继承了一个使用 cocoapods 的 iOS 项目。
repo 包含 Pods 目录,其中所有必要的 pod 都及时冻结。如果我克隆 repo 并构建应用程序,一切都很好。如果我运行pod update 然后构建,我会得到一个错误:
找不到 COOperation 的接口声明。
问题似乎与一个名为 CompositeOperations 的库有关,它是从特定的 git 帐户中提取的(不是直接从 cocoapods 中提取的——不确定这是否重要,但只是试图提供尽可能多的信息)。 Xcode 可以很好地找到该库,但由于某种原因,它没有加载接口文件中声明的类。
在 repo 中包含 Pods 目录对我来说似乎很愚蠢。我觉得开发人员应该克隆 repo,然后发出 git install 以取消所有依赖项。
对于我需要调整什么以使 Xcode 成功构建我的项目有什么建议吗?
MessageScreenDataFetchOperation.h 中的实际错误是:
/Users/user/src/myapp/myapp-iOS/Classes/Shared/Operations/MessageScreenDataFetchOperation.h:13:46: 找不到“COOperation”的接口声明,超类 'MessageScreenDataFetchOperation';你的意思是“NSOperation”吗?
这就是MessageScreenDataFetchOperation.h 的样子:
#import <CompositeOperations/COOperation.h>
@protocol GroupRef;
@interface MessageScreenDataFetchOperation : COOperation
- (id)initWithMessageId:(NSNumber *)messageId group:(id <GroupRef>)groupRef memberId:(NSNumber *)memberId;
@end
这是我的 Podfile:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target :MyTarget do
pod 'RestKit', '~> 0.24.0'
pod 'CompositeOperations', :git => 'https://github.com/stanislaw/CompositeOperations.git'
pod 'MBProgressHUD', '~> 0.8'
pod 'EKKeyboardAvoiding', '~> 2.0'
pod 'RBStoryboardLink', '0.1.0'
pod 'SWRevealViewController', '~> 2.0.0'
pod 'youtube-ios-player-helper', :git => 'https://github.com/stanislaw/youtube-ios-player-helper', :branch => '0.1.1-and-no-ads'
pod 'SZTextView'
pod 'MagicKit', :git => 'https://github.com/stanislaw/MagicKit'
pod 'ECPhoneNumberFormatter', :git => 'https://github.com/enriquez/ECPhoneNumberFormatter.git'
pod 'SSKeychain'
pod 'Mantle'
pod 'RSEnvironment', :git => 'https://github.com/rabovik/RSEnvironment'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
# Analytics
pod 'FlurrySDK', '5.1.0'
pod 'Fabric'
pod 'Crashlytics'
pod 'NewRelicAgent'
# Logging
pod 'EchoLogger', :git => 'https://github.com/stanislaw/EchoLogger'
pod 'AFNetworkingLogger', :git => 'https://github.com/stanislaw/AFNetworkingLogger'
end
target :MyTargetUnitTests do
pod 'OCMock', '~> 3.0'
pod 'Kiwi'
pod 'JPSimulatorHacks', :git => 'https://github.com/plu/JPSimulatorHacks'
end
【问题讨论】:
-
您可能应该显示您的 pod 文件、相关声明以及您如何导入 lib...
-
感谢@l'L'l,我已经粘贴了上面的所有内容。
标签: ios objective-c xcode cocoapods