2015-09-24 69 views
2

我按照Ray Wenderlich的說明創建了一個靜態庫(.a),並且沒有錯誤和警告地編譯它,然後將它包含在一個新項目中。當我試圖建立新的項目,我得到這個錯誤:靜態庫在Xcode上給出了奇怪的錯誤

error screenshot

/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:1:1: Source file is not valid UTF-8 
/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:1:5: Null character ignored 
/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:1:8: Expected identifier or '(' 
/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:2:3: Invalid filename for line marker directive 
/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:3:10: Null character ignored 

爲什麼我坐上庫這些錯誤,如果我正確編譯?

回答

2

這是完全錯誤:

#import "libInsightsLib.a" 

#import是用於導入頭文件,即源代碼的聲明。你告訴它導入一個已編譯的二進制庫,然後編譯器就嚇壞了。

您需要使用#import和.h作爲您試圖從該庫使用的任何內容。 .a會進入應用程序構建目標的鏈接階段。回到Ray的教程,我確信它會有這些細節。

+0

這就是對的!謝謝! – KurroCantos

+0

你可以建議如何導入呢? –