配置Xcode開發環境遇到的問題
配置Xcode開發環境遇到的問題
在虛擬機上安裝了新的mac系統,使用和舊機器相同的apple id,想要配一個於舊機器相同的開發環境。
於是升級了mac os x從10.7更新至10.7.4
然後下載了xcode 4.5安裝。(可以支援ios 6)
問題1:
到developer.apple.com下載development和distribution的certificates, 在Xcode
的organizer中refresh,可是在provisioning profiles的status顯示valid signing identity not found,而且在key chains中看“我的認證”裡面空白。“認證”裡面的證書沒有和新建的key綁定。
解決辦法:
在舊的系統中,打開key chians,找到開發和發佈用的key,逐個點右鍵,選輸出,然後將輸出的。p12文件拷貝到新系統中,拖到key然後輸入密碼進行安裝。之後organizer會自動refresh就可以看到provisioning profile的status變為“valid profile”
問題2:
將之前的project拷貝到新系統中,打開clean,build,提示有一個error:
"libxml/tree.h" file not found.
解決方法:
project -> Edit Project Setting -> Build 在 Seatch Paths中的 Header Search Paths
將之前的 /usr/include/libxml2 改為 $(SDKROOT)/usr/include/libxml2
完整的配置方法如下:
Adding libxml2 is a big, fat, finicky pain in the ass. If you're going to do it do it before you get too far in building your project.
Here's how.
Target settings
Click on your target (not your project) and select "Build Phases". Click on the reveal triangle titled "Link Binary With Libraries". Click on the "+" to add a library. Scroll to the bottom of the list and select "libxml2.dylib". That adds the libxml2 library 2 your project… but wait.
Project settings
Now you have to tell your project where to look for it three more times.
Select the "Build Settings tab". Scroll down to the "Linking" section. Under your project's columns double click on the "Other Linker Flags" row. Click the "+" and add "-lxml2" to the list.
Still more.
In the same tab, scroll down to the "Search Paths" section. Under your project's column in the "Framework Search Paths" row add "/usr/lib/libxml2.dylib".
In the "Header Search Paths" AND the "User Header Search Paths" row add "$(SDKROOT)/usr/include/libxml2". In those last two cases make sure that path is entered in Debug AND Release.
Then. Under the "Product" Menu select "Clean".
Then, if I were you (and let's face it I probably am) I'd quit Xcode and walk away. When you come back and launch you should be good to go.
問題3:
在build程式時有如下的錯誤提示:
…….libPhoneGapLib.a, file was built for archive which is not the architecture being linked (armv7s)…….
開始查資料
http://stackoverflow.com/questions/5303933/xcode4-linking-problem-file-was-built-for-archive-which-is-not-the-architecture
中遇到類似的問題,解決辦法是I changed 'Build Active Architecture Only' of TapkuLibrary from Yes to No and it compiles with no problem.
我在project的Build Settings中看到,Build Active Architecture Only已經設定為no。
Xcode cannot run using the selected device.
Choose a destination with a supported architecture in order to run on this device.