ios 异常错误积累

部分解决办法摘自网络

1.没找到对应的方法

'NSInvalidArgumentException',reason:'-[TestClass initEvent]:unrecognized selector send to instance 0x10011b330'

这里就是TestClass没有找到initEvent方法

2.找不到AViewController.xib,可能是xib的名字写错了,或者类与xib没有关联

2012-08-18 22:52:33.922 HelloiPhone[667:c07] *** Terminating app due to uncaught exception 

'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/xue/Library/Application 

Support/iPhone Simulator/6.0/Applications/063D5459-6BE3-43A6-8EB3-F03A43C42917/HelloiPhone.app> (loaded)' with name 

'AViewController''

3.uiviewController创建的时候关联了xib,

  1. Click on the xib in interface builder
  2. Select File's Owner on the left
  3. Open the File's Owner's connections inspector
  4. If the view property isn't yet wired, control-drag it to the view icon (under the file's owner and first responder icons).

reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but the view outlet was not set.'




4.

reason: ‘Could not instantiate class named NSLayoutConstraint

解决办法:需要关闭storyboard或xib界面文件的Use Auto Layout 选项,这是因为Auto Layout特性是iOS 6 新增加的,在之前的 5.0/5.1 Simulator模拟器中不支持。


5.

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'
没有storyboard,UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 将 forIndexPath:indexPath删掉即可,因为这个是和storyboard是对应配套的

6.Xcode5无法设置Deployment Target的解决方法

使用XCode5创建新项目的时候发现无法修改Deployment Target,只能选择iOS7,这是由于XCode5默认会选择在64位的环境下运行,在Build Settings中修改Architectures为Standard architectures(armv7, armv7s),回到General中即可修改Deployment Target为4.3以上的版本。


7.连了两次outlet

setValue:forUndefinedKey this class is not key value coding-compliant for the key
有可能是连了两次


8.

'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MainViewController" nib but the view outlet was not set.'

xib的File's Owner没有连view,右击File's Owner,在outlets栏里将view与主view连接




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值