您的位置:首页 > 移动开发 > IOS开发

IOS小知识点8之IOS调试过程错误情况一览

2014-10-30 13:55 471 查看
IOS调试过程中错误log信息一览:以后发现逐渐添加

(1)Terminating
app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[NSCFArray
insertObject:atIndex:]: mutating method sent to immutable object'

表示数组在添加新的成员的时候出错:将一个数据添加到一个不可变的对象中了(有可能是add上去的,可有可能是insert上去的)。有时候我们在定义NSMutableArray的时候,虽然定义的是这种类型,但是在使用的时候没有初始化,所以这个对象还是固定的。

例如:原代码

NSMutableArray *urls=[defaults
objectForKey:@"URLS"];

if (!urls) {

urls=[[NSMutableArray
alloc]init];

}

[urls addObject:textUrl];

代码修改为:

NSMutableArray *urls=[defaults
objectForKey:@"URLS"];

if (!urls) {

urls=[[NSMutableArray
alloc]init];

}

NSMutableArray *newurl = [[NSMutableArrayalloc]init];

[newurl addObjectsFromArray:urls];

[newurl addObject:textUrl];

urls = newurl;

(2)linker command failed with exit code 1 (use -v to see invocation)

Undefined symbols for architecture i386:

"_OBJC_CLASS_$_VRGCalendarView", referenced from:

objc-class-ref in InquirePlanViewController.o

ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)
这个问题真的是太大名鼎鼎了,使用、***第三方静态、动态库不可避免的都会碰到这个问题,那么如何去解决呢?

《1》最有可能是项目中引入了相同的文件,如库有某个fromwork,app中又重复引入了某个app。又如打包Framework中Build Phase中的架构和文件中的重复。

《2》修改下Build settings->Linking->Other Linker Flags 这个属性。设置为-ObjC -all_load

《3》核对下Search Paths中:

Library Search Paths 以及Header Search Paths
以及 Framework Search Paths的路径是否正确。

(3)另外iphone4 4s 5c都是32位系统,而5s 6都是 64位系统,因此在编码的时候,如:
NSInterger 这里在32位系统中是int类型,在64位系统中是long类型,因此要注意数据的完整性。
(4)The
scheme 'Appname' contains
no buildables that can be built
for the
`SDKs` supported
by the run destination iPhone
Retina (4-inch).
Make sure your
targets all specify
`SDKs` that are supported
by
this version of
`Xcode`.
一般都是IOS Development Target的版本不正确,这个是应用打包之后可以运行的最低版本。比如你的手机是IOS7.0的,这个地方就不能选择IOS7.1的系统。
Base SDK是指现在程序的源代码正在编译的版本。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐