ios 代码中遇到的bug

1.

NAME:NSInternalInconsistencyException

REASON:Could not load NIB in bundle: 'NSBundle </var/mobile/Application....cell.xib'

解决:编版本时xcode版本不统一导致

2.

播放音乐时内存暴涨

解决:在内层while循环中加autoreleasepool

3.

CoreFoundation-[NSObject(NSObject) doesNotRecognizeSelector:]+170 

CoreFoundation ___forwarding___ +392

CoreFoundation _CF_forwarding_prep_0 +24

这个问题通常是由于 instance没有实现某个selector导致的,或者是 instance已经被release了

4.

UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:

Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:]

通常是由于tableView:cellForRowAtIndexPath中的if else分支太多,某个分支返回nil导致的

5.

键盘输入没反应或者键盘消失不出来,通常是由于输入框的keywindow被抢走了导致的

6.

invalid number of rows in section 0.  The number of rows contained in an existing section after the update (18) must be equal to the number of rows contained in that section before the update (15), plus or minus the number of rows inserted or deleted from that section (1 inserted, 1 deleted).

原因:

加载到更多数据后Reloadtable的同时,拉取到图片reloadRowsAtIndexPaths:,然后就挂掉了,网上查到的原因是section中的rownum错乱了,但是不知道为什么导致的

解决方法:

图片拉取到后放到cell里面处理显示,不再调用reloadRowsAtIndexPaths:

 

7.

因为init NSDateFormatter比较耗时,所以就想共享一个。但是发现 stringFromDate是线程不安全的,多线程访问时会crash掉,解决方法如下:
NSDateFormatter *formatter = [。。。 shareNSDateFormatter]; 
 @synchronized(formatter) {
        timeStr = [formatter stringFromDate:[NSDate date]];
 }
 
8.
duplicate symbol for architecture i386  error
在网上找了好久,有人说是因为头文件总 import了.m文件,可是找了发现不是因为这个;然后又各种clean,都不行。
后来发现某个头文件,所有引用这个头文件的文件中.mm的文件都不会报这个错误,.m的会报这个错误, 然后这个头文件的实现文件是.mm文件。最后把所有报错的.m文件后缀都改成.mm就没问题了,结果这个也不是根本原因;
最后网上搜到是因为某个全局变量被重复引用了,在一个头文件里面找到了,把那个换到使用它的位置就ok了,啊啊啊啊啊。。。

转载于:https://www.cnblogs.com/zengheng/archive/2013/05/13/3075106.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值