iOS 崩潰問題

**一、NSInternalInconsistencyException negative sizes are not supported in the flow layout CoreFoundation ___exceptionPreprocess **app

出錯緣由:ide

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
設置Size爲負數

二、-[NSNull countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x1b705...指針

出錯緣由: 對NSNull類型進行遍歷致使崩潰。code

三、unrecognized seletor對象

出錯緣由:這種狀況很簡單,給一個對象發送了一條它不認識的消息。好比說你的.h中聲明瞭某一個方法,可是.m中卻沒有實現,並且你沒有對異常消息處理(消息轉發)就會形成這種現象。圖片

解決辦法:首先排查本身的某一些方法是否實現,其次看一下哪些對象接收了它不應接收的消息。it

四、EXC_BAD_ACCESS異常:io

出錯緣由:這種大多數是對象提早釋放,訪問了野指針的錯誤,也多是因爲memcpy的數據超出的給定的長度,致使破壞了後面對象的堆棧,出現處處亂崩的問題。變量

解決辦法:排查全部聲明爲weak對象的使用,是否在沒有持有的狀況下再次訪問了該對象(該對象已經被釋放),第二在MRC狀況下,排查一下因此已經release的對象(聲明一點,MRC中全局變量最好在dealloc方法中進行釋放),第三排查一下全部block,是否block被正常賦值等。object

五、UIApplicationInvalidInterfaceOrientation Supported orientations has no common orientation with the application, and [UIAlertController shouldAutorotate] is returning YES

出錯緣由:橫屏時推出UIAlertController

解決辦法:重寫UIAlertContrller 的shouldAutorotate 方法

- (BOOL)shouldAutorotate  
{  
    return NO;  
}

六、真機 The application bundle does not contain a valid identifier

解決辦法:刪除全部Xcode的構建文件 Xcode > Preferences > Locations > Derived Data 輸入圖片說明

相關文章
相關標籤/搜索