[Pod][Xcode] xxx file is not found.

SC Tuan
SC Tuan
Sep 7, 2018 · 2 min read

一日,我想要寫測試,所以開始在Xcode上寫測試,寫完之後開始測,發現有一個錯誤:

xxx file is not found.

xxx 是一個 pod module,於是我開始處理這個錯誤,結論如下。

Podfile忘記加上test target

由於這個test target是新增的,我發現Podfile上沒有寫,所以追加:

target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# 下段開始是我加的
# Pods for MyApp
target 'MyAppNewTests' do
inherit! :search_paths
# Pods for testing
end
# 到此結束
end

我加入的部分在中文的註解有寫。然後要做Pod的清除:

pod deintegrate

清除之後,其實Pod安裝的那些檔案還在,只是 Xcode 裡面就看不到了。

然後再次安裝:

pod install

追加Framework Search Path

很遺憾的,還是報出一樣的錯誤,於是我想說是不是search path有問題,就點選 MyAppNewTest 的Target去看看,發現 Build Settings 裡面的 Search Paths 根本是空的,於是加上了 $(inherited) ,然後 Xcode 強迫我重開。

再次打開 MyAppNewTestSearch Paths ,發現有路徑了,然後繼續測試,就沒有報錯誤了。

參考連結

SC Tuan

Written by

SC Tuan

iOS developer😘 / Web developer🤪/ anymore? 😎

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade