[xcode]常见错误
错误:“0.unrecognized selector sent to instance:”
1、向一个已释放对像发送信息
2、向一个不存在的对像发送信息,特别注意,有参数的方向法名要加":"号(@seletor(dosomething:))
2、向一个不存在的对像发送信息,特别注意,有参数的方向法名要加":"号(@seletor(dosomething:))
错误:“1.this class is not key value coding-compliant for the key ...”
1、interface build与代码中IBOutlet的连接所引起的。
2、在代码中对iboutlet的名称进行了修改,导致interface build中的连接实效。
3、如果在该viewcontroller连接的xib文件中没发现错误,那就很可能是mainWindow.xib文件中存在问题,在mainWindow.xib的tabbarcontroller的某个tab的viewcontroller设置了loadfrom"**.xib",但忘了将其class设为对应的viewcontroller类了。
错误“2.Local declaration of 'scrollView' hides instance variable”
1、己存在一个和
'scrollView'一样的外部变量(指针)
3. 使用 main.xib时,有 报“defines presentation context is not available prior to xcode 4.2 ”的waring。
解决: 选择main.xib的 navigation controller , 然后,Development选择 Xcode 4.2

错误:“4.Property with 'retain (or strong)' attribute must be of object type...”
通常是声名id,int等类型当作指针导致,不要*号即可。
错误:“5.Missing file warnings”
由于我使用了xcode自带的respositories,按照网上在终端输入指令的方法均不可行。这里我有个方法,在该项目xcode里在同一个地方新之建同一样的文件,然后在xcode里删除,即可。
错误:“6.mutating method sent to immutable object....”
mutating method(可变量对应的方法)
immutable object(不可改变的变量):
明白了吧?比如将NSMutableArray的方法用在NSArray上就会报这个错误。
immutable object(不可改变的变量):
明白了吧?比如将NSMutableArray的方法用在NSArray上就会报这个错误。
错误:“7.Multiple build commands for output file”
target引用了名字重复的资源,
找到当前的target,展开之后,找到Copy Bundle Resources栏目,然后在里面找到重复名字的资源,删除不要的那个即可
|