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模拟器中不支持。

ios 异常错误积累_第1张图片

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以上的版本。

ios 异常错误积累_第2张图片

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连接




你可能感兴趣的:(ios 异常错误积累)