Ril*_*Dev 2 xcode ios xctest swift
我不断收到错误
没有这样的模块“Alamofire”
在我的 Xcode 项目 swift 文件中使用时import Alamofire;该文件位于项目内的单独模块中。
我尝试了以下方法;
Alamofire目标Alamofire并运行项目,然后取消注释并再次构建<MyProject>.xcworkspacenot.xcodeproj$(inherited)在项目中使用> 构建设置 > 构建选项 > ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
更新 Cocoapods,删除并重新安装依赖项
但是,当我打开 swift 文件的检查器窗口时,目标成员身份同时选中了主应用程序和模块框。
当我取消选中文件所在的模块时,在我的seperateModuleTests文件中,我无法使用 swift 文件中使用的类,因为我收到错误;
使用未声明的类型
&&
使用未解析的标识符“ClassName”
当我取消选中用于测试的类的 swift 文件的目标成员资格时,seperateModuleTests似乎无法识别 swift 文件中的类。但是,当我检查 swift 文件的目标成员身份是单独模块的一部分时,我得到了原始错误。
任何人都可以帮助我了解为什么会发生这种情况以及如何解决?
我认为您缺少添加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
Run Code Online (Sandbox Code Playgroud)
您还可以使用与目标通用的所有 pod 进行配置
# 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
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助
| 归档时间: |
|
| 查看次数: |
4466 次 |
| 最近记录: |