我和我的团队陷入了一个奇怪的境地,其中涉及一个基础项目 + 内部包含一些协议的私有 pod。
我们的问题是我们无法从我们的基本应用程序代码中访问某些(协议)标识符(在私有 pod 中定义)。
显然,我们的问题似乎与这 2 个堆栈溢出线程中描述的问题完全相同,但他们的解决方案对我们不起作用。
线程 1:在 Swift 中找不到源文件
线程 2:安装了 CocoaPod 但没有看到 Swift 代码
我们使用的骨架是这个:
我们的 Commons pod(使用我们在基础应用程序中看不到的协议)是用这个 .podspec 文件定义的:
Pod::Spec.new do |s|
s.name = "Commons"
s.version = "0.1.10"
s.summary = "Commons framework"
s.description = <<-DESC "Commons framework"
DESC
s.homepage = "http://EXAMPLE/Commons"
s.license = { :type => "Commercial" }
s.author = { "Author" => "author@mail.mail" }
s.source = { :git => "GITLAB_PRIVATE_URL/commons-iOS-Pod.git", :tag => s.version }
s.source_files = "Commons", "Commons/**/*.{h,m,swift}"
s.exclude_files = "Commons/Exclude"
end
在我们的基础应用程序中,我们有以下 Podfile(将我们的 Commons pod 放到我们的主 xcworkspace 上)。
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'ios-appbase' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire'
pod 'ViewDeck'
pod 'JLRoutes'
pod 'Commons', :git => 'GITLAB_PRIVATE_URL/commons-iOS-Pod.git', :tag => '0.1.4', :branch => 'develop'
pod 'RestManager', :git => 'GITLAB_PRIVATE_URL/RestManager-iOS-Pod.git', :tag => '0.1.3'
pod 'BaseClasses', :git => 'GITLAB_PRIVATE_URL/BaseClasses-iOS-Pod.git', :tag => '0.1.3'
pod 'DesignManager', :git => 'GITLAB_PRIVATE_URL/DesignManager-iOS-Pod.git', :tag => '0.1.2'
end
我们已经将我们的协议定义为公开的(正如预期的那样,因为它存在于“Pods”项目中)。
还应该研究什么?
PS:不仅我们的自定义协议对我们的主应用程序是“不可见的”,而且在 Alamofire 中定义的协议也是我们主应用程序中包含的另一个 Pod。我们尝试使用它们,XCode 在编译时抱怨。
提前致谢。问候。
EDIT1:缩小我们的问题,我们认为这是在编译时发生的事情。为什么?因为 XCode 能够解决按 CMD+Click 的错误符号(在我们的 Pods 文件结构上定义的两个协议),但编译器不能这样做,它是抱怨“使用未声明类型”错误的那个。