1. 程式人生 > >級後,常常遇到的遇到的警告、錯誤,解決方法

級後,常常遇到的遇到的警告、錯誤,解決方法

1,警告:“xoxoxoxo”  is deprecated
解決辦法:檢視xoxoxoxo的這個方法的文件,替換掉這個方法即可。

2,警告:Declaration of "struct sockaddr" will not be visible outside of this function
解決辦法:在你的開源.m檔案中新增 #import <netinet/in.h>

3,警告:Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation'

解決辦法:型別不匹配。跳到出錯的那一行,UIInterfaceOrientation強制轉換為UIDeviceOrientation就行了。

4,警告:incompatible pointer types assigning to 'MyArrayList*'from 'NSMutableArray'
解決辦法:加入強制轉換(MyArrayList*)

5,警告:'&&' within '||'
問題出處:
    if (exists && !isDirectory || !exists)………
  解決辦法: if ((exists && !isDirectory) || !exists)………


6,警告:Warning:The Copy Bundle Resources build phase contains this target's Info.plist file
解決辦法:將Info.plist檔案移到Resources目錄下,而不要直接放在target下。


7,警告:在使用ASIHttp…第三方庫的,執行報錯。
解決辦法:看你的專案中是否新增CFNetwork.framework、SystemConfiguration.framework, MobileCoreServices.framework,
CoreGraphics.framework和libz.1.2.3.dylib,如果是sdk5.0以上,改新增libz.1.2.5.dylib


8,警告:xxxooo,missing required architecture i386 in file 
解決辦法:如果是錯誤資訊的話:
Target->Build Settings->Search Paths, 刪除FrameworkSearch Paths 裡面內容就可以了。
要只是一個警告的話,真機除錯可以過。具體解決方法待大神出現。 

9,警告:
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    把它後面的值,都刪除,再執行就解決了。

10,警告:
“ARC forbids synthesizing a property of an Objective-C object with unspecified ownership or storage attribute
解決辦法:如果定義了ARC有效,那麼必須要有所有者屬性的定義;所以程式碼改成下面這樣
@property (nonatomic, strong, readonly) NSString *ss; 

11,警告:
io6一下的xib系統均沒有自動選擇Use Autolayout, Supporting iOS 5 and below with xib of iOS 6 
解決辦法:Just un-select “Use Autolayout” in the file inspector of the xib’s view and we are back to the familiar autosizing in size inspector and boom, it supports iOS 5 and below.

12,警告:
Warning: Multiple build commands for output file xxx.png 
解決辦法:找到專案裡xxx.png重複,刪除重複的資源。