最近接手一個舊項目,一運行程序總是莫名其妙的奔潰,直接跳轉到main函數就不動了,控制台輸出錯誤信息:
NSScanner: nil string argument
NSScanner: nil string argument
libc++abi.dylib: terminate_handler unexpectedly threw an exception
谷歌一搜,有人說這種情況大多是字符串操作異常,但是很難定位到底是在哪里出了問題。也有人說先把集成友盟的代碼注掉就可以在控制台看到錯誤信息了。果斷把友盟的代碼注掉,結果果然輸出了以下錯誤信息:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
有這么一個錯誤信息就可以了,直接加上根控制器代碼即可。