1、報錯為Linker時,表示沒有導入所需的文件
2、EXC_BAD_ACCESS(SIGBUS或SIGSEGV):
通常由于內存管理問題引起,app進入毀壞狀態
這種錯誤通常是內存管理的問題,一般是訪問了已經釋放的對象導致的,可以開啟僵尸對象(Zombie?Objects)來定位問題:
在Xcode的菜單:
Product->Scheme->Edit?Scheme->Run????.app
右邊的選項中,選中Enable?Zombie?Objects
開啟該選項后,程序在運行時,如果訪問了已經釋放的對象,則會給出較準確的定位信息,可以幫助確定問題所在。
該功能的原理是,在對象釋放(retainCount為0)時,使用一個內置的Zombie對象,替代原來被釋放的對象。無論向該對象發送什么消息(函數調用),都會觸發異常,拋出調試信息。
記得在問題被修復后,關閉該功能
3、SIGBART:通常會在Debug Output窗口輸出一些錯誤信息
運行要使用iOS模擬器的程序時,如果出現了”Unable to run app in SimulatorAn error was encountered while running…”錯誤提示,只需iOS Simulator—>Reset Content and Setting…—>Reset即可
4、this class is not key value coding-compliant for the key leftView.'
出現這種錯誤意思是outlet沒有正確連接(但有時候已經正確連接了,只是之前有出現過沒有正確連接的情況,還抱這個錯誤,這就有可能是因為Xcode的緩存問題,沒有及時更新改動,這種情況下clean掉Xcode得緩存即可:command+shift+k)
故事板上的tableViewController上面cell上面的控件要想直接outlet連接成視圖控制器的屬性,必須得將其tableView的cell屬性設置成static cell不然系統無法區分是哪個cell的控件連接到視圖控制器,且在.m文件中得確定cell分區數和行數的方法要刪掉(這兩個方法是為可重用cell而編寫的。
5、reason: '*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs'
出現這種錯誤的原因是還沒有將視圖加進控制器中(self.view addSubview:xxxxxx),就先對這個視圖進行了布局constraint
6、ERROR: AddressSanitizer: heap-buffer-overflow on address
是因為開啟了AddressSanitizer,關閉之后就不會出現這個問題
7、code signing is required for product type 'Application' in SDK 'iOS 7.0',
就是說代碼簽名證書不對勁。
解決方案,
1.選擇工程->Build Settings -> Code Signing -> Code Signing Identity -> Debug -> Any ios SDK將選項改為:iPhone Developer
2.重新下載你的證書,或者修改通配符,或者說修改你的appid。選擇工程-》Bundle Identifier修改為最新的appid。造成這種原因是因為你修改了你的app sdk版本。
如果還不行,可以試試
Edit Project Setting下面的那個菜單:Edit Active Target “Hello World”=》Build=》Code Signing=》Any ios的值設置為iphone Developer
8、“App TransportSecurity has blocked a cleartext HTTP (http://) resource load since it isinsecure. Temporary exceptions can be configured via your app's Info.plistfile.”
簡而言之:ATS禁止了HTTP的明文傳輸,因為它不安全。可以修改Info.plist文件,讓它臨時允許明文傳輸。
解決辦法:
在Info.plist文件中添加"App Transport SecuritySettings", Type為"Dictionary",再添加"Allow Arbitray Loads", Type為"Boolean",“Value”為“YES”即可。
9、linker command failed with exit code 1 (use -v to see invocation)
一般為添加的靜態庫出錯,一般團隊多人的項目會出現這種情況,這時查看一下項目中的靜態庫,有些變成淺色的就說明該靜態庫添加失敗了,重新添加一遍之后就OK了。