1. 程式人生 > >xxx-Bridging-Header.h找不到CocoaPods管理的第三方庫.h檔案

xxx-Bridging-Header.h找不到CocoaPods管理的第三方庫.h檔案

由於CocoaPods根據target來install的,在標頭檔案匯入上比較嚴謹,有下面2個方法可以參考


1、不要用相對匯入,使用庫的方式匯入.h檔案

相對匯入(錯誤):

#import <XMPPFramework.h>

 庫方式匯入(正確): 
 

#import<XMPPFramework/XMPPFramework.h>

2、CocoaPods新增的庫預設為第一個target的依賴庫,預設該target才能引用,而新增的xxx-Bridging-Header.h沒有新增到該target上面,解決辦法如下:

刪除xxx-Bridging-Header.h的引用

Show in Finder 重新拖進專案中,記得勾選上Copy items if needed和Add to targets中的目標target(第一個)

接下來就使用相對匯入也是正確的

#import <XMPPFramework.h>