【发布时间】:2019-02-05 07:49:29
【问题描述】:
我正在尝试将这个 library 安装到我的项目(假设是子 xcodeproj)父项目(假设是父 xcodeproj)中。
Child .xcodeproj 有自己的 podfile,我在其中添加了 RxSwift、RxCocoa、Realm 和这个 GeoSwift 库。这是 cocoapods 文件,如下所示
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "9.0"
inhibit_all_warnings!
use_frameworks!
project 'LocationManager/LocationManager'
def pods
pod 'GEOSwift'
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
pod 'RealmSwift', '~> 3.0'
end
target 'LocationManager' do
pods
target 'LocationManagerTests' do
inherit! :search_paths
pod 'RxBlocking', '~> 4.0'
pod 'RxTest', '~> 4.0'
end
end
这个 LocationManager 作为另一个 podfile 安装到另一个 XCode 项目中
def location_pods
pod 'GEOSwift'
pod 'LocationManager', :git => 'git@github.com:myrepo/locationmanager.git', :branch => 'users/me/add-geoswift'
end
target 'TestApp' do
location_pods
project 'TestApp.project'
end
当我尝试编译 TestApp 目标时,XCode 抛出如下错误
找不到 GeoSwift 模块。此错误位于 Pods > LocationManager > MockLocationManager.swift 内部。在其他地方导入了相同的模块 Pods > LocationManager 工作。 import RxSwift 和 import RxCoca 也有效。当我访问Pods > Targets > LocationManager > Build Phases > Target Dependencies 时,我看到了除 GeoSwift 之外的所有 pod
我可以知道如何解决这个问题吗?将 GeoSwift 添加到此 targetDependency 也不会编译。将LocationManager.xcworkspace 编译为单独的实体时,它工作得非常好。该模块import GeoSwift 不会引发任何编译错误。
【问题讨论】:
-
您在第二个代码块的第 5 行末尾缺少一个结束单引号 (
')。会不会产生这样的问题? -
在安装 pod 后您是否清理并构建了您的工作区?
-
@MichaelHulet 感谢您的关注。只是打字时出错。那不是问题。
-
@Rivendell 不,也没有帮助
-
你尝试过更新 pod 吗?