[xcode]常見錯誤
錯誤:“0.unrecognized selector sent to instance:”
1、向一個已釋放對像發送信息
2、向一個不存在的對像發送信息,特別注意,有參數的方向法名要加":"號(@seletor(dosomething:))
2、向一個不存在的對像發送信息,特別注意,有參數的方向法名要加":"號(@seletor(dosomething:))
錯誤:“1.this class is not key value coding-compliant for the key ...”
1、interface build與代碼中IBOutlet的連接所引起的。
2、在代碼中對iboutlet的名稱進行了修改,導致interface build中的連接實效。
3、如果在該viewcontroller連接的xib文件中沒發現錯誤,那就很可能是mainWindow.xib文件中存在問題,在mainWindow.xib的tabbarcontroller的某個tab的viewcontroller設置了loadfrom"**.xib",但忘了將其class設爲對應的viewcontroller類了。
錯誤“2.Local declaration of 'scrollView' hides instance variable”
1、己存在一個和 'scrollView'一樣的外部變量(指針)
3. 使用 main.xib時,有 報“defines presentation context is not available prior to xcode 4.2 ”的waring。
解決: 選擇main.xib的 navigation controller , 然後,Development選擇 Xcode 4.2
錯誤:“4.Property with 'retain (or strong)' attribute must be of object type...”
通常是聲名id,int等類型當作指針導致,不要*號即可。
錯誤:“5.Missing file warnings”
由於我使用了xcode自帶的respositories,按照網上在終端輸入指令的方法均不可行。這裏我有個方法,在該項目xcode裏在同一個地方新之建同一樣的文件,然後在xcode裏刪除,即可。
錯誤:“6.mutating method sent to immutable object....”
mutating method(可變量對應的方法)
immutable object(不可改變的變量):
明白了吧?比如將NSMutableArray的方法用在NSArray上就會報這個錯誤。
immutable object(不可改變的變量):
明白了吧?比如將NSMutableArray的方法用在NSArray上就會報這個錯誤。
錯誤:“7.Multiple build commands for output file”
target引用了名字重複的資源,找到當前的target,展開之後,找到Copy Bundle Resources欄目,然後在裏面找到重複名字的資源,刪除不要的那個即可
|
|
|
|
總結了前人的錯誤總結 有更新繼續總結 感謝前人朋友