ios单元测试项目配置中遇到的问题及解决方案

  • 1.Xcode 9 - Test target X encountered an error (Unable to connect to Test Manager)

    困扰一天的问题,烦死,原来只要重启下手机就解决了

  • 2.CocoPods 管理的库文件找不到头文件.

  • 第一步,修改podfile重新pod install
source 'https://github.com/CocoaPods/Specs.git'
platform:ios,'10.0'
target 'ProjectName' do
  # Uncomment this line if you're using Swift or would like to use dynamic framworks
use_frameworks!

pod 'AFNetworking', '~> 3.0'

target 'ProjectNameTests' do
    inherit! :search_paths
end

target 'ProjectNameUITests' do
    inherit! :search_paths
end

end
  • 第二步,分别在Test/UITest Target中的BuidlSetting 中搜索Head Search Path中添加 ${SRCROOT} 并且查找方式选择recursive

  • 3.找不到Framerwork文件,需要在Run Search Path添加 $(FRAMEWORK_SEARCH_PATHS),如果这样还找不到清楚缓存文件试试:xcode->profrences->locations->DerivedData->删除文件下的缓存.

  • 4.运行UITest的时候在Runing Test…显示黑屏,重启手机无效,删除缓存文件也没用,最后换了个USB接口解决了,蛋蛋的忧伤啊.

你可能感兴趣的:(ios开发)