Xcode裡常見警告和錯誤的解決方法

2021-06-18 08:39:47 字數 1580 閱讀 8017

1、error: macro names must be identifiers yourproject_prefix.pch

原因: 因為你弄髒了預處理器巨集,在它處於的時候修改了它

解決方法: configiration選擇all configirations,清空它 然後分別重新定義你的debug,release,distributin預處理器巨集吧

2、warning: no rule to process file '$(project_dir)/loadingview.h' of type sourcecode.c.h for architecture armv6

原因: target裡compile sources裡含有標頭檔案 了,那裡面不需要標頭檔案

解決方法: 從target裡compile sources裡刪除標頭檔案

3、command /developer/platforms/iphoneos.platform/developer/library/xcode/plug-ins/iphoneos build system support.xcplugin/contents/resources/copypng failed with exit code 1

原因: png影象檔案拷貝失敗,看看資訊上面提示can't find哪個檔案,一般都是從檔案系統裡刪除檔案而沒有通過xcode刪除造成的,xcode的專案配置檔案依然紀錄著這個檔案的引用

解決辦法: 給檔案系統裡增加相應的檔案,或者從xcode的groups & files刪除它,或者從target的copy bundle resources裡刪除它

4、code sign error: the identity 'iphone developer: your name' doesn't match any valid certificate/private key pair in the default keychain

原因: 簽名錯誤

解決辦法: target -> get info -> build -> code signing -> 修改簽名

記得左上角的configuration型別要跟當前build型別對應(debug, release, distribution),否則改了也白改

5、could not create bundle folder for versioned model *.moda(好像是這個字尾名的這個檔案)

原因:編譯一次會產生乙個新的

解決辦法:應該把編譯產生出來的moda檔案都刪了,然後clean下工程,重新build即可

6、error:there are no valid certificate/private key pairs in the default keychain

7、error:cannot assign to 'self' outside of a method in the init family

原因:只能在init方法中給self賦值,xcode判斷是否為init方法規則:方法返回id,並且名字以init  

+大寫字母開頭+其他  為準則。例如:- (id) initwith***;

出錯**:- (id) myinit

解決方法:- (id) initwithmy

iOS開發 常見錯誤和警告總結

nsstring是大家最常用的乙個類,幾乎人人都脫離不開,它的功能非常強大,但是它其中有點奧秘直到碰到了才發現。正文 nsstring的api中有乙個rangeofstring 這個也是大家常用的在字串中查詢的的api。我一般圖省事,都是用這個,很少用rangeofstring option 找到了...

iOS開發 常見的錯誤與警告

1.error undeclared first use in this function 還沒有定義 在此函式中第一次使用 注 使用某乙個變數時,如果使用前還沒有定義,會出現該錯誤。在oc以及c語言中,使用變數前必須先定義它。這個錯誤經常出現在忘記進行變數定義的情況下。但是,慢慢拿習慣後,這種錯誤...

C語言程式的錯誤和警告

一段 在編譯 鏈結和執行的各個階段都可能會出現問題。編譯器只能檢查編譯和鏈結階段出現的問題,而可執行程式已經脫離了編譯器,執行階段出現問題編譯器是無能為力的。如果我們編寫的 正確,執行時會提示沒有錯誤 error 和警告 warning 如下圖所示 圖1 dev c 的提示 圖2 vc 6.0 的提...