I’m trying to register my own class in a tableView so I could use the internal cell pool, but it crashes at the second I try to invoke this
this._cellIdentifier = new NSString(VignetteCell.vignetteIdentifier);
this._photosListTableView.RegisterClassForCellReuse(typeof(UITableViewCell), this._cellIdentifier);
I also tried with using “typeof(VignetteCell)” but it fails also. The weird thing is that it doesn’t crash on the simulator.
This is what I get:
[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[UITableView registerClass:forCellReuseIdentifier:]: unrecognized selector sent to instance 0x1cf3800
at MonoTouch.UIKit.UITableView.RegisterClassForCellReuse (IntPtr cellClass, MonoTouch.Foundation.NSString reuseIdentifier) [0x00027] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UITableView.g.cs:743
at MonoTouch.UIKit.UITableView.RegisterClassForCellReuse (System.Type cellType, MonoTouch.Foundation.NSString reuseIdentifier) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UITableView.cs:34
...
I just find nothing on Google mentioning it, as if I were the only guy on this planet who tried that!
Anyway, thanks for your help!
[Edit]
Solution: In fact, it just doesn’t work on iOS 5. I tried it on my iPhone 5 and it just work fine.
What device/simulator are you running this on? Since this is a iOS 6 specific feature, it will need to be running on iOS 6 and running on iOS 5 will cause the following error message.