本文转载至 http://blog.csdn.net/yesjava/article/details/8086185 

1. mutating method sent to immutable object'

从字面上理解:可变的消息发给了不可变的对象。比如NSDictionary类型的对象调用setValue方法.应该把NSDictionary 改成NSMutableDictionary类型。

 

2.Local declaration of 'content' hides instance variable

 

一般是函数里面定义的变量和class属性变量重名了。很少有和系统变量重名的情况。

 

3.unrecognized selector sent to instance 

大部分情况下是因为对象被提前release了,在不希望他release的情况下,指针还在,对象已经不在了。

很多时候,是因为init初始化函数中,对属性赋值没有使用self.foo赋值,而是直接对foo赋值,导致属性对象没有retain(心里以为retain了),而提前释放。

4.使用ASIHTTPRequest编译不通过

原因是一些类库没有加进去。把这些库加进去CFNetwork, SystemConfiguration, MobileCoreServices, and libz.dylib

5.添加在UIView中的UIButton   单击不起作用

原因是UIbutton的frame超出了UIView的frame范围。事实上UIView并没有设置frame,设置完后( 范围一定要在UIButton之外),UIButton单击就可以了

6.当使用presentViewController和dismissPresentViewController时,如果报这个错 : while  presentation is in progress ,修改方法为[mainView dismissModalViewControllerAnimated:NO];  将参数Animated改为NO;如果报这个错while a presentation or dismiss is in progress,试试这样

 if (![[mainView modalViewController] isBeingDismissed]) {
        [mainView dismissModalViewControllerAnimated:NO];
    }
7.调用系统相册的时候,非常容易出现内存警告,加入红色代码就会好点:

 
        UIImagePickerController * picker = [[UIImagePickerController alloc]init];
        picker.delegate = self;
        picker.allowsEditing = NO;  //是否可编辑
        picker.videoQuality=UIImagePickerControllerQualityTypeLow;
        //摄像头
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        [self presentModalViewController:picker animated:YES];
        [picker release];

8.ios开发者都遇见过得错误:EXC_BAD_ACCESS 。这个和第二个比较类似。通常的调试方法就是加入NSZombieEnabled变量,加入方法自行百度。

并且开发过程中使用

[[NSNotificationCenterdefaultCenter]

来发布本地消息,这个也经常会出现EXC_BAD_ACCESS错误。这个时候只需要在你的view活着viewControllers的dealloc的方法里面加入

[[NSNotificationCenterdefaultCenter]removeObserver:selfname:@"yourNotification"object:nil];就ok了

9.遇见一个蛋疼的问题"linker command failed with exit code 1 (use -v to see invocation)" 。翻遍了找不到原因。然后还有这样的警告

duplicate symbol _OBJC_CLASS 。原来是在导入某个类的时候导入.m文件,而不是.h文件

最新文章

  1. JDBC入门之一--连接Mysql实验
  2. debain 8安装为知笔记(how to install wiznote in debain 8)
  3. 微软 .net 你更新这么快IDE vs2015 、语法糖 6.0、framework、‘吹得这么牛,然并用
  4. 转载WPF SDK研究 之 AppModel
  5. XMPP Server
  6. maven打成war包之后没有class文件
  7. mongoDB索引使用
  8. Exception in thread "main" java.lang.NoClassDefFoundError: UDP_Receive (wrong na me: com/ray/net/UDP_Receive)
  9. c#局域网文件搬移
  10. Django数据库迁移
  11. Eclipse安装Hibernate插件快速生成配置文件
  12. Netty高可靠性设计:优化建议
  13. k8s源码分析准备工作 - 源码准备
  14. 服务器管理员密码修改后SQL_Server_2008无法启动
  15. 工作中遇到的问题收集--.NET
  16. flex 分页
  17. C# GDI绘制波形图
  18. 编译gRPC Go版本使用的 ProtoBuffer 文件
  19. 深入理解net core中的依赖注入、Singleton、Scoped、Transient(三)
  20. 'workspace' in VS Code

热门文章

  1. aoj 2226 Merry Christmas
  2. 10个JavaScript难点--摘抄
  3. 转 PHP中exec、system等函数调用linux命令问题
  4. java打包python到exe文件
  5. LNMP 之 Nginx负载均衡服务器
  6. Requery,Refresh,Adoquery.Close,Open 区别
  7. loading上下左右居中
  8. jenkins按版本发布maven项目
  9. spring版本不兼容JDK问题
  10. filter 中用spring StopWatch 监控请求执行时间