Xcode 升级后,常常遇到的遇到的警告、错误,解决方法

从sdk3.2.5升级到sdk 7.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重复,删除重复的资源。

//以下是升级到 xcode 5.0.1 之后使用遇到的警告
13,警告:
 “iOS 模拟器”未能安装此应用程序。
解决办法:删除模拟器上当前要运行那个APP,重新运行项目。就ok

14,警告:
SpringBoard无法启动应用程序 错误:-3
解决办法:退出模拟器,重新运行这个项目。

15,警告:
The server certificate failed to verify.   
解决办法:
1、打开终端(实用工具 -->终端),在终端中输入如下命令:
svn ls https://192.100.1.11?0/svn/xxxxxx(注意下面的url更换成你自己的url地址)
然后直接输入 “ p ”  确认,就可以重新连接了。

16,警告:
Bitmasking for introspection of Objective-C object pointers is strongly discouraged.   
解决办法:
某数字& 0x1的时候是代表要取最低位是否为1,改成了  if(JK_EXPECT_F(((NSUInteger)object)%2))即可。

17,警告:
Implicit conversion loses integer precision: 'unsigned long' to 'CC_LONG' (aka 'unsigned int').   
解决办法:
    CC_MD5(str,strlen(str), r);,改成了     CC_MD5(str, (CC_LONG)strlen(str), r);即可。

18,警告:
error: failed to launch '/private/var/mobile/Applications/xxxxx' -- failed to get the task for process 11140.   
解决办法:
    重启你的开发手机即可,还有一种可能是你的开发者证书与发布证书搞错了,检查在xcode中证书是否一直 。

19,警告:
error: ignoring filxxxxxx/libBaiduMobStat.a, missing required architecture x86_64 in filexxxx/libBaiduMobStat.a   
解决办法:
    targets ->build setting 下的  architectures 设置为 standard architetures(armv7,armv7s)   vaild architectures 设置为armv7,armv7s。

20,警告:
error: Directory not found for option '-L/Users/joryoubonxx/BaiduStatistic   
解决办法:
  删除  targets ->build setting 下的  library search path不正确的地址,如果还不行,重新添加第三库、clean ,重启Xcode.即可。

遇到相关的警告,一般编译器都会提供解决方案,所以,作为新手,我们应该看懂编译器给我们的提示,这样我们解决问题就会事半功倍。

uiview 2012-10-10 12:17
1,  错误信息:
  "_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" 文件

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

3 、 错误信息:
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就可以了。

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

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

6 、 错误信息:
 error: Existing instance variable '_datasource' for property 'datasource' with  assign attribute must be __unsafe_unretained

解决方法:
     id<ListViewDataSource> _datasource; 改为     __unsafe_unretained id<ListViewDataSource> _datasource:即可

7 、 错误信息:
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  即可.

8 、 错误信息:
error: failed to launch"/private/var/mobile/Applications/XX"-- timed out waiting for app to launch  .

解决方法:
     targets ->build setting 下的 把证书选择为 对应正确的开发证书  即可.

湘南七少 2012-10-10 16:52
3q,先阅读明天升级.哎界面修改一大堆
uiview 2012-10-16 15:03
31,警告:
 warning: Semantic Issue: Incompatible integer to pointer conversion assigning to 'BOOL *' (aka 'signed char *') from 'BOOL' (aka 'signed char')
解决办法: 检查 BOOL *换为BOOL就可以了,检查是不是多写一个   *  号。

32:Jsonkit中的警告
Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()
object->isa 替换为 object_getClass(object)
keyObject->isa 替换为 object_getClass(keyObject)
(id)keys[idx]->isa 替换为 object_getClass((id)keys[idx])
format specifies type 'unsigned long' but the argument has type 'nsuinteger' (aka 'unsigned int')
给变量增加(unsigned long)进行类型转换

33:md5加密(iOS SDK中自带了CommonCrypto
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]];  
    }  
引入函数定义的头文件
#import <CommonCrypto/CommonDigest.h>

34:ASIDataDecompressor中的警告
format specifies type  'short' but the  argument has type 'int'
在+ (NSError *)deflateErrorWithCode:(int)code 和 +(NSError *)inflateErrorWithCode:(int)code中
[NSString stringWithFormat:@"Compression of data failed with code %hi",code] 中
将code改为 (short)code,类型转换

35:Reachability中警告
Using 'stringWithString:' with a literal is redundant
statusString = [NSString stringWithString: @"Not Reachable"]; 
改为:statusString = @"Not Reachable";

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

37 Using 'stringWithString:' with a literal is redundant
改为:self.locationInput.text = @"captured change";

38 在项目中设置控件的layer属性时,会发生错误,
"Property 'c' cannot be found in forward class object 'CALayer *",
这时需要引入  #import <QuartzCore/CALayer.h>。

39 在项目中变量未初始化会报警告,
"Variable 'type' may be uninitialized when used here",
这时需要初始化相应的变量即可  。

uiview 2012-11-30 10:58
41,错误

Error launching remote program: failed to get the task for process   

解决方法:
把真机上的软件,删除,然后,clean 一下,重新运行就可以了。

42,真机调试的时候,出现   [attachment=49364]   这正常,但是不识别机器的。

解决方法:

把 , [attachment=49365] 设置为以上相对应的版本就可以了。

43,真机调试的时候,出现   ios Broken pipe

解决方法:
:推出xcode
:断开机器(iphone,ipad,ipod)链接
:重启iPhone在联接xcode,就可以了。

zcrrr 2013-08-01 10:59
这么好的帖子,顶一个,谢谢
mop150 2013-09-24 19:04
iOS真机调试中出现identity(The identity 'iPhone Developer)证书不匹配的问题

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

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

fansj 2013-09-26 14:02
        
anhuijhy 2013-11-12 10:07
果断mark 一下
陈2011 2013-11-12 12:52
这个问题怎么解决呀  求解答  scanf函数输入就会弹出
陈2011 2013-11-12 12:52
初学者还在用xcode 写c
luxxxxxxx 2013-11-12 21:43
好帖,收藏了
uiview 2013-11-15 10:23
可以从编译器的提示看出,&p.name[20]; 取结构体变量里边name元素(字符数组)的第20个字符的地址,就对了。
p.name 本身就是字符数组的地址。希望贴图的时候,顺便把原代码贴出,这样方便别人替你查错。

xcode升级到6.0以后遇到的警告错误解决方法的更多相关文章

  1. xcode升级到6.0以后遇到的警告错误 原帖链接http://www.cocoachina.com/bbs/simple/?t112432.html

    Xcode 升级后,常常遇到的遇到的警告.错误,解决方法 从sdk3.2.5升级到sdk 7.1中间废弃了很多的方法,还有一些逻辑关系更加严谨了.1,警告:“xoxoxoxo”  is depreca ...

  2. mysql(8.0连接navicat发生的错误解决方法)

    关于mysql(8.0连接navicat发生的错误解决方法)数据库安装图形化界面无法更改加密的方式导致无法连接问题为解决; Alter user 'root'@'localhost' identifi ...

  3. sklearn.cross_validation 0.18版本废弃警告及解决方法

    转载:cheneyshark 机器环境: scikit-learn==0.19.1 Python 2.7.13 train_test_split基本用法 在机器学习中,我们通常将原始数据按照比例分割为 ...

  4. hexo 升级5.4.0出现错误解决方法-hexo-theme-butterfly

    本篇文章已同步个人博客,可移步食用.hexo 升级 5.4.0 出现错误解决方法 -hexo-theme-butterfly 周末升级了下 hexo 到新版本,发现升级后,构建时出现了一些错误,以下是 ...

  5. error at ::0 can't find referenced pointcut...解决方法

    error at ::0 can't find referenced pointcut...解决方法 学习了:http://dyldragon.iteye.com/blog/512612 升级aspe ...

  6. Xcode真机测试could not find developer disk image解决方法

    原文地址:http://my.oschina.net/u/2340880/blog/521700 Xcode真机测试could not find developer disk image解决方法 在使 ...

  7. IIS6.0服务器搭建网站无法访问解决方法

    IIS6.0服务器搭建网站无法访问解决方法     IIS6.0服务器搭建网站无法访问解决方法很多朋友在用IIS6架网站的时候遇到不少问题,而这些问题有些在过去的IIS5里面就遇到过,有些是新出来的, ...

  8. CentOS下php使用127.0.0.1不能连接mysql的解决方法

    这篇文章主要介绍了CentOS下php使用127.0.0.1不能连接mysql的解决方法,本文原因是SELINUX导致的连接失败,需要的朋友可以参考下 php代码很简单: 复制代码代码如下: $ser ...

  9. Error, some other host already uses address 192.168.0.202错误解决方法

    Error, some other host already uses address 192.168.0.202错误解决方法 今天配置虚拟机网卡的时候遇到错误:Error, some other h ...

随机推荐

  1. SharePoint 2013 中的 URL 和标记

    SharePoint 2013 中的 URL 的类型                SharePoint 2013 分析 URL 字符串以基于指定的协议(例如,http:)确定 URL 的格式或确定正 ...

  2. net4:MultiView(view)行为中的commmandname与commmandargument,ListBox的使用及移动操作

    原文发布时间为:2008-07-29 -- 来源于本人的百度文章 [由搬家工具导入] using System;using System.Data;using System.Configuration ...

  3. XSD(XML Schema Definition)学习笔记

    今天学习了XSD相关的知识,为了以后查找的方便,写一些笔记. 一.什么是XSD? 1.XSD全称:XML Schema Definition.XML Schema 的作用是定义 XML 文档的合法构建 ...

  4. bzero 字符数组清零

    原来bzero()是这个功能,学习啦.下面的文章可以好好参考,出处:http://hi.baidu.com/wg_wang/item/5fa42c15c73b8efa9c778af8 bzero &a ...

  5. 在线扩展根分区 red hat 4.8.3-9

    跑程序的时候发现报错,提示空间不足,仔细查看后发现是根分区已满 27G的空间只有20k剩余 考虑从/data分区压缩一点空间到/分区 切换到root用户 执行下面的命令 1. umount /data ...

  6. linux tomcat shutdown.sh 有时不能结束进程,使用如下指令进度重启

    ps -ef | grep tomcat | grep -v grep | cut -c 9-15 | xargs kill -9 & ./startup.sh

  7. rocketMq---------相关命令

    搭建就不详细说了,cent7.x的系统,openJdk8,maven3.x,gradle4.10.2, git 1.8.3.1 直接下载相关的二进制压缩包,解压即用,方便. 下面看常用的管理命令 ro ...

  8. Maven依赖机制理解

    假设一个项目需要用到日志组件Log4j,那么有如下方式添加这个组件. 一.传统方式: 1.访问官网https://logging.apache.org/log4j/2.x/download.html, ...

  9. 【spring data jpa】使用spring data jpa时,关于service层一个方法中进行【删除】和【插入】两种操作在同一个事务内处理

    场景: 现在有这么一个情况,就是在service中提供的一个方法是先将符合条件的数据全部删除,然后再将新的条件全部插入数据库中 这个场景需要保证service中执行两步 1.删除 2.插入 这两步自然 ...

  10. 【spring mvc】后台的API,测试中,总提示接口实体的某一个字段不能为null,但是明明给值了还提示不能为空

    实体是这三个字段 接口的实现类Controller 前台测试给值 依旧报错 解决方法: 需要添加@RequestBody注解