iOS开发中常见崩溃原因汇总,你遇到了吗?

来源:互联网 发布:北京房山网络职业学院 编辑:程序博客网 时间:2024/06/17 13:51

 来自小白整理!不喜勿喷!有错请指正!关注小白!共同成长!

1.reason: '-[AppDelegate button1]: unrecognized selector sent to instance 0x8c764c0'

翻译: 发送的请求未能识别 

2.
屏幕快照 2015-12-19 下午3.29.16.png





解释 :内存管理过渡释放

3.
屏幕快照 2015-12-21 下午4.01.20.png
  
方法声明重复 



4.

'Invalid update: invalid number of rows in section 1.  The number of rows contained in an existing section after the update (0) must be equal to the number of rows contained in that section before the update (5), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'

 解释 : 无效更新

5.

reason: '*** -[NSUserDefaults setObject:forKey:]: attempt to insert non-property list object <UIImage: 0x8d32f70> for key 图片'


 解释 :  视图插入未规定的数据 

6 reason: '-[people encodeWithCoder:]: unrecognized selector sent to instance 0x8cdb290'

 people 类调用的方法不能识别 ( 方法没有实现).




7.

reason: 'unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

cell的重用有问题

8:   1. The resource could not be loaded because the App Transport Security policy requires the use of a secure connection
//资源不能被加载,因为应用程序传输安全策略需要使用一个安全的连接

2.   App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

//应用交通安全已经阻止了明文的HTTP(http://)资源负载,因为它是不安全的。暂时的异常可以通过应用程序的配置信息。plist文件。

解决办法:
//在Info.plist文件中添加"App Transport SecuritySettings", Type为"Dictionary",再在此目录下添加"Allow Arbitray Loads", Type 为"Boolean",“Value”为“YES”即可。
eg: 


设置宏定义


debug 测试版本 跟上架版本数据请求不同时 

#def… if debug
//测试版本请求
#def..else
//上架版本请求
#def..end


编译错误 : 
linker command failed with exit code 1 (use -v to see

翻译:     链接器命令失败,退出码1(使用- v

解决方法:

linker command failed with exit code 1 (use -v to see invocation)的错误调试
情况1、


        linker command failed with exit code 1 (use -v to see invocation)这个错误貌似遇见并不止一次,当我想用某个第三方类库的时候(如SBJson),我直接把类库文件copy到工程目录里面,然后一编译就出现这样错误(并不是一定会出这样错误),开始以为是网上下载的类库本身问题,所以重新找类库或者其他方式将它添加进去,只要不出错就行,也一直没有深入了解根本问题,今天在给工程添加一个FMDB(SQLIte第三方类库)文件编译时又出现这种错误,一开始以为工程问题,但是新建工程后还是出现这个问题,经过网上查找,得到了解决办法;



[cpp] view plaincopy
  1. Undefined symbols for architecture i386:  
  2.   "_OBJC_CLASS_$_FMDatabase", referenced from:  
  3.       objc-class-ref in ViewController.o  
  4. ld: symbol(s) not found for architecture i386  
  5. clang: error: linker command failed with exit code 1 (use -v to see invocation)  


linker command failed with exit code 1 (use -v to see invocation)的异常调试


在网上得到解决办法是:

在工作左边导航栏Target-->Build Phases-->compile Sources中,第三库库的所有.m文件都添加到里面,然后编译通过了;


linker command failed with exit code 1 (use -v to see invocation)的异常调试


添加.m文件

linker command failed with exit code 1 (use -v to see invocation)的异常调试


根据对比可以看见 in FMDBTest,FMDBTest的Target里添加进去了了一些.m文件

linker command failed with exit code 1 (use -v to see invocation)的异常调试


对于以上错误,根据网友解答我的理解是

我们在使用这些第三方类库文件时直接将其拖拽到工程之中,编译的的时候Xcode也没有自动引用,所以造成这样错误,这就需要我们手动添加。假如我们在工程中新建某个文件就不会出现这样问题;


参考  http://blog.hsin.tw/2012/ios-dev-undefined-symbols-for-architecture-i386/


情况2、


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

出现这种情况很可能是,项目中引入了多个相同的文件。删除一个就ok!
情况3、

xcoder的一个编译错误:

 

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

 

说明有无法准确找到的函数,函数有重复现象。

 

造成这个错误的原因是我直接在 .h头文件中实现了几个函数,然后这个头文件又被别的.c文件所引用,有实现的。

 

所以解决办法是把实现的几个函数单出一个.c文件里去。这样就ok了。


情况4、 

把 Valid Architectures  的值改为 armv7

过程:

PROJECT --> Build Settings --> Architectures --> Valid Architectures  他的值本来是 armv7 armv7s  (ios6.0下)  把armv7s 去掉即可

同样的操作

TARGETS -->  Build Settings --> Architectures --> Valid Architectures  做同样的修改


情况5、 很奇葩的情况啊,就是引用第三方的静态库.a 出现了问题. 在模拟器和真机引入的静态库是分开的!!!当然如果你的静态库做成了统一的,那就不会出现情况5.






0 0