XCode 常見錯誤

來源:互聯網
上載者:User

0.unrecognized selector sent to instance:
1、向一個已釋放對像發送資訊
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上就會報這個錯誤。
7.Multiple build commands for output file

target引用了名字重複的資源,找到當前的target,展開之後,找到Copy Bundle Resources欄目,然後在裡面找到重複名字的資源,刪除不要的那個即可

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.