部分常見警告與錯(cuò)誤的解決方法與思路,具體問題具體分析解決。
一、常見警告如下:
1.警告:“xoxoxoxo”is deprecated
解決辦法:查看xoxoxoxo的這個(gè)方法的文檔,替換掉這個(gè)方法即可。
2.警告:Warning:The Copy Bundle Resources build phase contains this target"s Info.plist file
解決辦法:將Info.plist文件移到Resources目錄下,而不要直接放在target下。
3.警告:在使用ASIHttp…第三方庫(kù)的,運(yùn)行報(bào)錯(cuò)。
解決辦法:看你的項(xiàng)目中是否添加CFNetwork.framework、SystemConfiguration.framework, MobileCoreServices.framework,
CoreGraphics.framework和libz.1.2.3.dylib,如果是sdk5.0以上,改添加libz.1.2.5.dylib
4.警告:xxxooo,missing?required?architecture?i386?in?file
解決辦法:如果是錯(cuò)誤信息的話:Target->Build Settings->Search Paths, 刪除FrameworkSearch Paths 里面內(nèi)容就可以了。要只是一個(gè)警告的話,真機(jī)調(diào)試可以過。
5.警告:
clang: error:?no such file or directory: "/demo2/控件代碼/13/Recorder/Recorder_Prefix.pch"
clang: error: no input files
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
解決辦法: 在你的主工程文件 target搜素,pch ,找到Prefix Header??? 把它后面的值,都刪除,再運(yùn)行就解決了。
6.警告:
“ARC forbids synthesizing a property of anObjective-Cobject with unspecified ownership or storage attribute
解決辦法:如果定義了ARC有效,那么必須要有所有者屬性的定義;所以代碼改成下面這樣
@property?(nonatomic,?strong,?readonly)?NSString?*ss;
7.警告:
Warning:?Multiple build commands for output file xxx.png
解決辦法:找到項(xiàng)目里xxx.png重復(fù),刪除重復(fù)的資源。
8.警告:
“iOS 模擬器”未能安裝此應(yīng)用程序。
解決辦法:刪除模擬器上當(dāng)前要運(yùn)行那個(gè)APP,重新運(yùn)行項(xiàng)目。就ok
9.警告:
SpringBoard無法啟動(dòng)應(yīng)用程序 錯(cuò)誤:-3
解決辦法:退出模擬器,重新運(yùn)行這個(gè)項(xiàng)目。
10.警告:
The server certificate failed to verify.
解決辦法:
打開終端(實(shí)用工具 -->終端),在終端中輸入如下命令:
svn ls?https://192.100.1.11?0/svn/xxxxxx(注意下面的url更換成你自己的url地址)
然后直接輸入“p”確認(rèn),就可以重新連接了。
11.警告:
error: failed to launch "/private/var/mobile/Applications/xxxxx" -- failed to get the task for process 11140.
解決辦法:
重啟你的開發(fā)手機(jī)即可,還有一種可能是你的開發(fā)者證書與發(fā)布證書搞錯(cuò)了,檢查在xcode中證書是否一致 。
12.警告:
error: ignoring filxxxxxx/libBaiduMobStat.a, missing required architecture x86_64 in filexxxx/libBaiduMobStat.a
解決辦法:
targets ->build setting 下的??architectures 設(shè)置為 standard architetures(armv7,armv7s)?? vaild architectures 設(shè)置為armv7,armv7s。
13.警告:
error: Directory not found for option "-L/Users/joryoubonxx/BaiduStatistic
解決辦法:
刪除??targets ->build setting 下的??library search path不正確的地址,如果還不行,重新添加第三庫(kù)、clean ,重啟Xcode.即可。
14.警告:
error: The executable was signed with invalid entitlements.
解決辦法:
重新導(dǎo)入最新的證書即可
15.警告:
warning:?Semantic Issue: Incompatible integer to pointer conversion assigning to "BOOL *" (aka "signed char *") from "BOOL" (aka "signed char")
解決辦法: 檢查 BOOL *換為BOOL就可以了,檢查是不是多寫一個(gè)?? *? 號(hào)。
二、常見錯(cuò)誤如下:
1,??錯(cuò)誤信息:
"_OBJC_CLASS_$? xxxxx? ", referenced from:??????objc-class-ref in ViewController.old: symbol(s) not found for architecture i386clang: error:?linker command failed with exit code 1 (use -v to see invocation)
解決方法:?查看工程,看是不是沒有導(dǎo)入相關(guān)的框架?;蛘吖こ汤锾砑拥挠邢嗤?.m",".h" 文件
2、錯(cuò)誤信息:
Couldn"t register dy.CKRiLiText with the bootstrap server. Error:?unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.Current language:? auto; currently objective-c
解決方法:?可能是電腦內(nèi)存問題引起,重啟電腦即可解決。如果重啟解決不了問題,那就是你剛剛改動(dòng)的代碼引起的問題。
3、錯(cuò)誤信息:
ios 5是調(diào)試正常的,ios 6真機(jī)調(diào)試的時(shí)候,出現(xiàn)如下錯(cuò)誤:ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/mac4/Desktop/my desktop/My app/MyApp name 20:09:12 ?/MyApp name/ZBarSDK/libzbar.a for architecture armv7serror:?linker command failed with exit code 1 (use -v to see invocation)
解決方法:在Xcode里,點(diǎn)擊相應(yīng)的Target,然后點(diǎn)Build Settings,找到VALID_ARCHS,看里面的是不是arvm7s,如果不是改成arvm7s就可以了。
4、錯(cuò)誤信息:
error:?receiver type "ViewController" for instance message does not declare a method with selector "hideSearchBar:" [4]
ViewController 中沒有聲明一個(gè)方法選擇"hideSearchBar:
解決方法:在ViewController .h 中聲明一下這個(gè)方法 “?hideSearchBar?”??即可。
5、錯(cuò)誤信息:當(dāng)json從服務(wù)端請(qǐng)求時(shí)得到的字符串,如果這樣寫的話,會(huì)報(bào)錯(cuò),";" after top level declarator
NSString *ss= @"{"recommend":"世界末日","dogname":"機(jī)器人"}";??解決方法:
就是,把 ? “???替換成??\"? 即可。NSString *ss= @"{?\"recommend?\":?\"世界末日?\",?\"dogname?\":?\"機(jī)器人?\"}";
6、錯(cuò)誤信息:
error: Existing instance variable "_datasource" for property "datasource" with? assign attribute must be __unsafe_unretained
解決方法:???? id _datasource; 改為 ??? __unsafe_unretained id _datasource:即可
7、錯(cuò)誤信息:
error: No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).
解決方法:???? targets ->build setting 下的 Build Active Architecture Only 設(shè)置 NO??即可.
8、錯(cuò)誤信息:
error: failed to launch"/private/var/mobile/Applications/XX"-- timed out waiting for app to launch??.
解決方法:???? targets ->build setting 下的 把證書選擇為 對(duì)應(yīng)正確的開發(fā)證書??即可.
9、在項(xiàng)目中設(shè)置控件的layer屬性時(shí),會(huì)發(fā)生錯(cuò)誤,"Property "c" cannot be found in forward class object "CALayer *",
這時(shí)需要引入??#import 。
10、在項(xiàng)目中變量未初始化會(huì)報(bào)警告,"Variable "type" may be uninitialized when used here",
這時(shí)需要初始化相應(yīng)的變量即可??。
11、錯(cuò)誤信息:
Error launching remote program: failed to get the task for process
解決方法:
把真機(jī)上的軟件,刪除,然后,clean 一下,重新運(yùn)行就可以了。
12 、真機(jī)調(diào)試的時(shí)候,出現(xiàn)?? ios Broken pipe
解決方法:
a:推出xcode
b:斷開機(jī)器(iphone,ipad,ipod)鏈接
c:重啟iPhone在聯(lián)接xcode,就可以了
13、iOS真機(jī)調(diào)試中出現(xiàn)identity(The identity "iPhone Developer)證書不匹配的問題提示(null) error: could not read CFBundleIdentifier from Info.plist (null)新建一個(gè)同名工程,拷貝其plist文件,將原工程中的plist文件替換掉即可。