iOS項目之報錯筆記


問題一:

    linker command failed with exit code 1 (use -vto see invocation)

    原因:導入了.m的頭文件,導致同時有兩個一樣的.m文件在編譯

問題二:

    Xcode真機測試報錯:Could not launch “xxx”

    解決方案一:1.刪除/Users/(用戶名)/Library/Developer/Xcode/DerivedData/(對應APP程序)文件夾

                     2.拔掉手機,刪除對應的APP程序,完全退出Xcode工具

                     3.重新連接手機進行真機測試

    解決方案二:進行過真機抓包測試,關閉HTTP代理

    解決方案三:1.選擇手機中“設置” -> “通用” -> “設備管理” -> 選擇自己對應的開發商應用 -> “刪除應用”

        2.重新運行Xcode中的程序,這個時候應該還會報錯

          3.再次進入自己對應的開發商應用 -> “驗證應用”

          4.再次運行Xcode中的程序就OK了

    

  情況二:

    

  xcode為11+

    

  分析原因:

    在網上找了很多關於Could not launch "xxx"的原因,都沒有解決自己的問題,然后自己進行檢查配置時,發現了證書配置問題,修改證書后,就沒有再出現這樣的問題了,於是把這個記錄一下。

  解決方案:

    

    這里根據自己的環境配置對應的證書。

  情況三:

     

   解決方案:在下載一些第三方demo時,運行到真機上會出現這樣的提示信息,需要在“設置” -> “通用” -> “設備管理”-> 點擊信任

 

問題三:

    Warning! ivar size mismatch in PSUICollectionView_ of 80 bytes - can't change the superclass.

    解決:1.搜索PSUICollectionView,找到.m文件

            2.搜索char filler,在[]中的數據上加上警告提示的數據

 

問題四:

    ***Terminating app due to uncaught exception '...', reason:'[<...>  setValue:forUndefinedKey:]:this class is not key value coding-compliant for the key ....'

    問題原因:xib中連線出問題

 

問題五:

    ***Terminating app due to uncaught exception '...', reason:'-[... ...]:unrecognized selector sent to instance ...'

    問題原因:某個對象沒有實現某個方法

 

問題六:

  iOS國際化時遇到的錯誤:read failed: the data couldn't be read because it isn't in the correct format.

  問題原因:在國際化的時候,寫key,寫着寫着就忘了加 ";"

 

問題七: 

  *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [187.5 nan]'

  問題原因:某個控件在設置CGRect類型的屬性(如frame、bounds、......)中寬高設置了0,導致程序在計算中除以了0。

 

問題八:

  Xcode意外閃退,錯誤信息:

Process:               Xcode [587]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               8.2.1 (11766.1)

Date/Time:             2017-03-13 13:44:38.076 +0800
OS Version:            Mac OS X 10.12.3 (16D32)
Report Version:        12

Time Awake Since Boot: 150 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Application Specific Information:
ProductBuildVersion: 8C1002
UNCAUGHT EXCEPTION (NSInternalInconsistencyException): Error getting value for key 'strategyClass' of extension 'KSImageNamed.CompletionStrategy.ImageNamed' in plug-in 'com.ksuther.KSImageNamed'
UserInfo: {
    ......
}
Hints: None

  解決問題:找到/Users/(用戶名)/Library/Developer/Xcode/Plug-ins文件夾,將里面的KSImageNamed.ideplugin插件刪除,重啟Xcode。

問題九:Warning:whose view is not in the window hierarchy!

  分析:可能在界面完全退出之前,進行展示信息界面(如Alert)。

  解決:修改調用的順序,在界面退出之后在展示。

 

問題十:

  The behavior of the UICollectionViewFlowLayout is not defined because:

  the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.

  分析:automaticallyAdjustsScrollViewInsets根據按所在界面的status bar,navigationbar,與tabbar的高度,自動調整scrollview的 inset

  解決:在viewDidLoad方法中添加 self.automaticallyAdjustsScrollViewInsets = NO;

 

問題十一:

  linker command failed with exit code 1 (use -v to see invocation)

  

  分析:在項目中使用了第三方,但沒有被添加到編譯列表中

  解決:項目 -> TARGETS -> Build Phases -> Compile Sources,點擊 + 號進行添加對應的 .m文件

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM