Ios Xcode:没有这样的模块';阿拉莫菲尔';
我一直在犯错误 没有这样的模块“Alamofire” 在我的Xcode项目swift文件中使用Ios Xcode:没有这样的模块';阿拉莫菲尔';,ios,swift,xcode,xctest,Ios,Swift,Xcode,Xctest,我一直在犯错误 没有这样的模块“Alamofire” 在我的Xcode项目swift文件中使用导入Alamofire;该文件位于项目中的单独模块中 我试过以下方法 构建并运行阿拉莫菲尔Target 注释掉importAlamofire并运行项目,然后取消注释并重新构建 确保我使用的是.xcworkspace而不是.xcodeproj 在项目>生成设置>生成选项>始终嵌入\u SWIFT\u标准\u库中使用$(继承) 更新Cocoapods,删除并重新安装依赖项 但是,当我打开swift文件的
导入Alamofire
;该文件位于项目中的单独模块中
我试过以下方法
- 构建并运行阿拉莫菲尔Target
- 注释掉import
并运行项目,然后取消注释并重新构建Alamofire
- 确保我使用的是
而不是.xcworkspace
.xcodeproj
- 在项目>生成设置>生成选项>始终嵌入\u SWIFT\u标准\u库中使用
$(继承)
- 更新Cocoapods,删除并重新安装依赖项
单独模块测试
文件中,我无法使用swift文件中使用的类,因为我得到了错误
未声明类型的使用
&&
使用未解析标识符“ClassName”
当我取消选中用于测试的类的swift文件的目标成员身份时,separateModuleTests
似乎无法识别swift文件中的类。但是,当我检查swift文件的目标成员资格是否是单独模块的一部分时,我得到了原始错误
有谁能帮我解释为什么会发生这种情况,以及我如何解决 我认为您在测试目标中缺少add
Alamofire
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'AppName' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for AppName
pod 'SwiftyJSON'
pod 'Alamofire', '4.4.0'
target 'AppNameTests' do
inherit! :search_paths
pod 'Alamofire', '4.4.0'
end
target 'AppNameUITests' do
inherit! :search_paths
pod 'Alamofire', '4.4.0'
end
end
最好是
您还可以对目标共用的所有吊舱进行配置
# Uncomment this line to define a global platform for your project
platform :ios, '8.2'
# Uncomment this line if you're using Swift
use_frameworks!
# Define main pods.
def main_pods
#Your common pods here
pod 'Alamofire', '4.4.0'
end
target 'AppName' do
main_pods
#add here other pods specific for this target
end
target 'AppNameTests' do
main_pods
#add here other pods specific for this target
end
target 'AppNameUITests' do
main_pods
#add here other pods specific for this target
end
希望这有助于运行清理:产品>清理然后构建
如果那不起作用。这是如何使用的?它是用于您自己的代码,还是另一个需要使用AlamoFire的模块?您是否在pod文件中添加了测试目标配置?否,不是用于单独的模块。我已经为项目本身
目标'appTests'做了如下继承!:搜索路径#测试结束的播客
你能发布你的播客文件内容吗?@ReinierMelian检查更新的问题,谢谢你打开扩展名为.xcodeproj
的蓝色文件还是扩展名为.xcworkspace
的白色文件?您应该打开后者…不幸的是,问题仍然存在,感谢您的建议它位于另一个模块中,需要导入AlamoFire
,单独模块中的swift文件似乎无法访问Pod依赖项