(Turn) Xcode's warning and error solutions

Forwarded, no source of the original found.

1. Warning: "xoxoxoxo" is deprecated
Solution: Check the documentation of this method of xoxoxoxo and replace this method.

2, Warning: Declaration of "struct sockaddr" will not be visible outside of this function
Solution: Add #import <netinet/in.h> to your open source .m file

3, Warning: Implicit conversion from enumeration type 'UIInterfaceOrientation ' to different enumeration type 'UIDeviceOrientation'
solution: Type mismatch. Jump to the line where the error occurred, and cast UIInterfaceOrientation to UIDeviceOrientation.

4. Warning: incompatible pointer types assigning to 'MyArrayList*' from 'NSMutableArray'
Solution: Add cast (MyArrayList*)

5. Warning: '&&' within '||'
The source of the problem:
    if (exists && !isDirectory || !exists)…………
  Solution: if ((exists && !isDirectory) || !exists)…………

6. Warning: Warning: The Copy Bundle Resources build phase contains this target's Info.plist file
Solution: Move the Info.plist file to the Resources directory instead of placing it directly under the target.

7. Warning: When using ASIHttp... a third-party library, an error will be reported.
Solution: See if you add CFNetwork.framework, SystemConfiguration.framework, MobileCoreServices.framework,
CoreGraphics.framework and libz.1.2.3.dylib to your project, if it is above sdk5.0, add libz.1.2.5.dylib instead

 8. Warning: xxxooo, missing required architecture i386 in file 
Solution: If it is an error message:
Target->Build Settings->Search Paths, delete the contents of FrameworkSearch Paths.
If it's just a warning, the real machine debugging can pass. The specific solution is waiting for God to appear. 

9. Warning:
clang: error: no such file or directory: '/demo2/control code/13/Recorder/Recorder_Prefix.pch'
clang: error: no input files
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

Solution: Search in your main project file target, pch, find the Prefix Header and delete all the values ​​behind it, then Running it will solve it.

10. Warning:
"ARC forbids synthesizing a property of an Objective-C object with unspecified ownership or storage attribute
Solution: If the definition of ARC is valid, then there must be a definition of the owner attribute; so the code is changed to the following
@property ( nonatomic, strong, readonly) NSString *ss; 

11, Warning:
Use Autolayout is not automatically selected for xib systems below io6, Supporting iOS 5 and below with xib of iOS 6 
Solution: 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:
Warning: Multiple build commands for output file xxx.png 
Solution: Find the duplicate xxx.png in the project and delete the duplicate resource.

13. Warning:
 "iOS Simulator" failed to install this application.
Solution: Delete the APP that is currently running on the simulator and re-run the project. On ok

14, warning:
SpringBoard could not start application error: -3
Workaround: Exit the emulator and rerun the project.

15. Warning:
The server certificate failed to verify.   
Solution:
1. Open the terminal (Utilities --> Terminal), and enter the following command in the terminal:
svn ls  https://192.100.1.11?0 /svn/xxxxxx ( Note that the url below is replaced with your own url address)
and then directly enter "p" to confirm, you can reconnect.

16. Warning:
Bitmasking for introspection of Objective-C object pointers is strongly discouraged.   
Solution:
When a number & 0x1 means whether the lowest bit is 1, change it to if(JK_EXPECT_F(((NSUInteger)object)% 2)) can be.

17. Warning:
Implicit conversion loses integer precision: 'unsigned long' to 'CC_LONG' (aka 'unsigned int').   
Solution:
    CC_MD5(str,strlen(str), r);, change it to CC_MD5(str, (CC_LONG)strlen(str), r);.

18. Warning:
error: failed to launch '/private/var/mobile/Applications/xxxxx' -- failed to get the task for process 11140.  
Solution:
    restart your development phone, there is another possibility that your The developer certificate and the release certificate are wrong, check whether the certificate is the same in xcode.

19. Warning:
error: ignoring filxxxxxx/libBaiduMobStat.a, missing required architecture x86_64 in filexxxx/libBaiduMobStat.a   
Solution:
    The architectures under targets ->build setting are set to standard architetures(armv7,armv7s) vaild architectures is set to armv7,armv7s .

20. Warning:
error: Directory not found for option '-L/Users/joryoubonxx/BaiduStatistic   
Solution:
  Delete the incorrect address of the library search path under targets -> build setting. If it still doesn't work, re-add the third library, clean, and restart Xcode.

21. Warning:
 warning: Semantic Issue: Incompatible integer to pointer conversion assigning to 'BOOL *' (aka 'signed char *') from 'BOOL' (aka 'signed char')
Solution: Check BOOL * to BOOL Now, check whether there is an extra asterisk.

22:Warning in Jsonkit
Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()
object->isa is replaced by object_getClass(object)
keyObject->isa is replaced by object_getClass(keyObject)
(id)keys[ idx]->isa is replaced by object_getClass((id)keys[idx])
format specifies type 'unsigned long' but the argument has type 'nsuinteger' (aka 'unsigned int'



Implicit declaration of function 'CC_MD5' is invalid in C99
[plain] view plaincopy
    #define CC_MD5_DIGEST_LENGTH 16  
    +(NSString *)MD5HashForString:(NSString *)input {  
        const char *cStr = [input UTF8String];  
        unsigned char result[CC_MD5_DIGEST_LENGTH];  
        CC_MD5(cStr, strlen(cStr), result);  
        return [NSString stringWithFormat: @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",  
                result[0], result[1], result[2], result[3],  
                result[4], result[5], result[6], result[7],  
                result[8], result[9], result[10], result[11],  
                result[12], result[13], result[14], result[15]];  
    }  
Header file importing function definition
#import <CommonCrypto/CommonDigest.h>

24:Warning in ASIDataDecompressor
format specifies type 'short' but the argument has type 'int'
in +(NSError *)deflateErrorWithCode:(int)code and +( NSError *)inflateErrorWithCode:(int)code in
[NSString stringWithFormat:@"Compression of data failed with code %hi",code]
, change code to (short)code, type conversion

25: Warning
Using 'stringWithString:' in Reachability with a literal is redundant
statusString = [NSString stringWithString: @"Not Reachable"]; 
instead: statusString = @"Not Reachable";

26  format specifies type 'id' but the argument has type 'const char *'
NSCAssert(NO, @"Unhandled error encountered during SAX parse. msg is %@", msg);
Change to: NSCAssert(NO, @"Unhandled error encountered during SAX parse. msg is %@", [NSString stringWithUTF8String:msg]);

27  Using 'stringWithString:' with a literal is redundant
Change to: self.locationInput.text = @"captured change";

28 When setting the layer property of the control in the project, an error will occur,
"Property 'c' cannot be found in forward class object 'CALayer *",
then you need to import #import <QuartzCore/CALayer.h >.

29 If the variable is not initialized in the project, a warning will be reported,
"Variable 'type' may be uninitialized when used here",
then the corresponding variable needs to be initialized.

 

30, 错误信息:
  "_OBJC_CLASS_$  xxxxx  ", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解决方法:
 查看工程,看是不是没有导入相关的框架。或者工程里添加的有相同".m",".h" 文件

31,  错误信息:
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
解决方法: 可能是电脑内存问题引起,重启电脑即可解决。如果重启解决不了问题,那就是你刚刚改动的代码引起的问题。

32 、 错误信息:
ios 5是调试正常,ios 6真机调试的时候,出现如下错误: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里,点击相应的Target,然后点Build Settings,找到VALID_ARCHS,看里面的是不是arvm7s,如果不是改成arvm7s就可以了。

33、 错误信息:
 error: receiver type 'ViewController' for instance message does not declare a method with selector 'hideSearchBar:' [4]
ViewController 中没有声明一个方法选择'hideSearchBar:
解决方法:
在ViewController .h 中声明一下这个方法 “ hideSearchBar ”  即可。

34、 错误信息:当json从服务端请求时得到的字符串,如果这样写的话,会报错,';' after top level declarator
NSString *ss= @"{"recommend":"世界末日","dogname":"机器人"}";  
解决方法:
就是,把   “   替换成  \"  即可。NSString *ss= @"{ \"recommend \": \"世界末日 \", \"dogname \": \"机器人 \"}";  

35、 错误信息:
 error: Existing instance variable '_datasource' for property 'datasource' with  assign attribute must be __unsafe_unretained
解决方法:
     id<ListViewDataSource> _datasource; 改为     __unsafe_unretained id<ListViewDataSource> _datasource:即可

36、 错误信息:
error: No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).
解决方法:
     targets ->build setting 下的 Build Active Architecture Only 设置 NO  即可.

37、 错误信息:
error: failed to launch"/private/var/mobile/Applications/XX"-- timed out waiting for app to launch  .
解决方法:
     targets ->build setting 下的 把证书选择为 对应正确的开发证书  即可.

 

38,错误
Error launching remote program: failed to get the task for process  
解决方法:
把真机上的软件,删除,然后,clean 一下,重新运行就可以了。
       
39,真机调试的时候,出现   ios Broken pipe
解决方法:
:推出xcode
:断开机器(iphone,ipad,ipod)链接
:重启iPhone在联接xcode,就可以了。

 

40 提示(null) error: could not read CFBundleIdentifier from Info.plist (null)

 

新建一个同名工程,拷贝其plist文件,将原工程中的plist文件替换掉即可。

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326746541&siteId=291194637