# [titanium]更新到xcode4.3.1（IOS 5.1）後的錯誤

- URL: https://justfly.idv.tw/titanium%e6%9b%b4%e6%96%b0%e5%88%b0xcode4-3-1%ef%bc%88ios-5-1%ef%bc%89%e5%be%8c%e7%9a%84%e9%8c%af%e8%aa%a4/
- 日期: 2012-03-09
- 分類: 瞎子摸OS
- 標籤: error, install, iphone, SDK, Titanium

ipad3已經發表了！siri小姐都已經會說日文了！想說既然之前有碰到[ios5跟ios4很微妙的bug](https://justfly.idv.tw/2012/03/07/Just_1116.html)，不如就來更新一下SDK當做慶祝吧！！！

更新xcode一點也不難，到[Apple Developer](https://developer.apple.com/downloads/index.action)中下載安裝就好了！

只是再打開titanium，重新用SDK5.1想要發佈時，卻是下面的error!!!!

> Traceback (most recent call last):
>  File “/Library/Application Support/Titanium/mobilesdk/osx/1.8.1/iphone/builder.py”, line 1537, in main(sys.argv)
>  File “/Library/Application Support/Titanium/mobilesdk/osx/1.8.1/iphone/builder.py”, line 702, in main iphone_version = check_iphone_sdk(iphone_version)
>  File “/Library/Application Support/Titanium/mobilesdk/osx/1.8.1/iphone/builder.py”, line 66, in check_iphone_sdk return sorted(found,version_sort)[0] IndexError: list index out of range

查了很多資料，好像是目前titanium只支援到Xcode 4.2?????

總之得先想辦法把sdk變回4.3再說。（我覺得自己好給洨＠＠）

但是重新安裝一次Xcode 4.2也沒有用。好不容易在Xcode中發現可以下載舊版的sdk的地方：

https://justfly.idv.tw/wp-content/uploads/2012/03/スクリーンショット-2012-03-08-22.05.44.png

再度回到titanium中，發現可愛的sdk 4.3也回家了！只是問題依然沒有解決。於是乎又再度回到google大海中，但是卻依然沒有找到有用的那根針….

就在正要絕望之際，在titanium的設定中發現一行提示！！然後我打開Terminal，依照提示輸入：

```
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
```

終於可以順利發佈到iphone上了！！！

以結果來推斷，就是xcode的路徑改變了，所以找不到它！

很歡喜的想再來看一下在模擬器上的樣子，卻遇到另一個問題！模擬器起動不了！！這下也是遭一個大糕！！！

> Library not loaded: @rpath/DevToolsFoundation.framework/Versions/A/DevToolsFoundation
>  Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/Versions/A/iPhoneSimulatorRemoteClient
>  Reason: image not found

總不可能在debug的時候都發佈到iphone上吧！？光等它跑完的時間我都可以去環遊世界了！依照剛剛的經驗，應該也是路徑跑掉的問題。只是要設到哪邊是對的？？？我又跳入海中了……

最後依照[這篇](http://seanfreitag.wordpress.com/category/ios/)「一針見血」的方式：

```
sudo ln -s /Applications/Xcode.app/Contents/Developer/ /Developer

sudo ln -s /Applications/Xcode.app/Contents/OtherFrameworks/DevToolsCore.framework /Developer/Library/PrivateFrameworks/
sudo ln -s /Applications/Xcode.app/Contents/OtherFrameworks/DevToolsCParsing.framework /Developer/Library/PrivateFrameworks/
sudo ln -s /Applications/Xcode.app/Contents/OtherFrameworks/DevToolsFoundation.framework /Developer/Library/PrivateFrameworks/
sudo ln -s /Applications/Xcode.app/Contents/OtherFrameworks/DevToolsInterface.framework /Developer/Library/PrivateFrameworks/
sudo ln -s /Applications/Xcode.app/Contents/OtherFrameworks/DevToolsKit.framework /Developer/Library/PrivateFrameworks/
sudo ln -s /Applications/Xcode.app/Contents/OtherFrameworks/DevToolsRemoteClient.framework /Developer/Library/PrivateFrameworks/
sudo ln -s /Applications/Xcode.app/Contents/OtherFrameworks/DevToolsSupport.framework /Developer/Library/PrivateFrameworks/
```

https://justfly.idv.tw/wp-content/uploads/2012/03/スクリーンショット-2012-03-09-1.26.58.png才順利啟動…..

這整件事情燒掉了將近要7個小時….還好最後是可以在ios5的模擬器中測試app了。而且隨機附贈ios5.0跟ios4.3的模擬器，也算是有收獲啦！只是這種路徑跑掉的問題不是應該在安裝的時候就幫我們設好嗎？總之，希望[這篇文章](https://justfly.idv.tw/2012/03/09/Just_1128.html)可以幫助到其他正在苦海之中沈淪的夥伴們嚕…..
