I have created UITableView
project in XCode 4.6 with iOS 6.1 SDK, and set target sdk to 5.1, when the app calling dequeueReusableCellWithIdentifier
in cellForRowAtIndexPath
function, the app throw a exception, the simulator is 5.1, on simulator 6.x is ok.
1:
[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]:
unrecognized selector sent to instance
2:Terminating app due to uncaught exception NSInvalidArgumentException
, reason: -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]:
unrecognized selector sent to instance
1. dequeueReusableHeaderFooterViewWithIdentifier
Availability
Available in iOS 2.0 and later.
-> Minimum iOS version required to run this function is iOS 2.0
2 .dequeueReusableCellWithIdentifier:forIndexPath:
Availability
Available in iOS 6.0 and later.
-> Minimum iOS version required to run this function is iOS 6.0
EDIT IF your want to use this function the you can check your current device version and then implement this
If you look at the Apple documentation, you'll see that
dequeueReusableCellWithIdentifier: forIndexPath:
came in with iOS 6.0.That means if you try to call this method on iOS 5.X devices, it's going to throw an exception.
It would be better if you used the older "
dequeueReusableCellWithIdentifier:
" call if possible.One big difference between the two calls is that the latter (older) one can return nil, in which case you need to alloc/init a new reuseable cell.