2013年3月18日 星期一

常遇到的錯誤訊息與解決方式


  • 錯誤訊息:Undefined symbols for architecture i386 error
遇到這個錯誤碼代表你Code中有使用到你尚未載入的framework,把該加入的framework加一加就可以compile過了

  • 錯誤訊息:Apple Mach-O Linker Error 
解決方式:Project ->Build Settings -> Build Active Architecture Only -> 設成YES


  • 錯誤訊息:linker command failed with exit code 1 
解決方式: 把 Valid Architectures 的值改為 armv7 : PROJECT --> Build Settings --> Architectures --> Valid Architectures 他的值本來是 armv7 armv7s (ios6.0下) 把armv7s 去掉即可 同樣的操作 TARGETS --> Build Settings --> Architectures --> Valid Architectures 做同樣的修改 後來發現發生這些錯誤是因為引用了EVENTKIT但沒有先匯入它


  • 錯誤訊息:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil'
解決方式:有些之前拉過的線已經失效了,把它找出來刪掉即可。
  • 錯誤訊息:*** Assertion failure in -[UITableViewCell _setHostsLayoutEngine:], /SourceCache/UIKit/UIKit-3318.16.14/NSLayoutConstraint_UIKitAdditions.m:2760
解決方式:在你的storyboard中有些TableView的content屬性為Dynamic Prototypes,你卻拉了客製化的cell進去TableView中。或者是你把cell直接拉到UIView當中。看樣子iOS7以後對cell的階層定義的很嚴格。

  • 錯誤訊息:file '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/limits.h' has been modified since the precompiled header '/Users/YourName/Library/Developer/Xcode/DerivedData/YourProject-bafemyyfpibvkfbxdrsjfkyzjmxb/Build/Intermediates/PrecompiledHeaders/YourProject-Prefix-hkhsfrjbjnwlltfbputhdimgctvv/YourProject-Prefix.pch.pch' was built
解決方式:在你重新安裝xcode之後,舊的專案的暫存檔會跟新的衝突,所以要先把暫存檔資料夾清空,打開你的終端機輸入
cd ~/Library/Developer/Xcode/DerivedData/ModuleCache,然後用rm -f -r ./*把這裡的cache都清掉。


  • 錯誤訊息:process launch failed: NotFound

解決方式:如果xcode一直跳出這訊息,無法實機測試,把手機重新開機就可以了。

  • 錯誤訊息:*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "SignupViewController" nib but the view outlet was not set.'

解決方式:跳這個訊息代表你在Xib的File's Owner的view沒有連上UI上的view。


  • 錯誤訊息:

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x0000000195757bdc objc_msgSend + 28

解決方式:到Project -> Build Settings -> ENABLE_STRICT_OBJC_MSGSEND 將它設為NO。

  • 錯誤訊息:Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."

解決方式:Apple在iOS 9的更新訊息中提到預設為強制使用https當作api的網址。

但如果你必須要用http可以去Info.plist修改預設值。
1. 新增App Transport Security Settings欄位
2. 把欄位下的Allow Arbitrary Loads設為YES
或是把欄位下的Exception Domains加入你的網址

沒有留言:

張貼留言