2

我正在尝试在 tableView 中注册我自己的类,以便我可以使用内部单元池,但它在我尝试调用它的第二个崩溃

this._cellIdentifier = new NSString(VignetteCell.vignetteIdentifier);
this._photosListTableView.RegisterClassForCellReuse(typeof(UITableViewCell), this._cellIdentifier);

我也尝试使用“typeof(VignetteCell)”,但它也失败了。奇怪的是它不会在模拟器上崩溃。

这就是我得到的:

[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 
...

我只是在谷歌上发现没有提到它,好像我是这个星球上唯一一个尝试过的人!

无论如何,感谢您的帮助!

[编辑]

解决方案:事实上,它在 iOS 5 上不起作用。我在我的 iPhone 5 上尝试过,它运行良好。

4

1 回答 1

3

你在什么设备/模拟器上运行它?由于这是 iOS 6 特有的功能,它需要在 iOS 6 上运行,并且在 iOS 5 上运行会导致以下错误消息。

于 2013-01-28T13:00:27.800 回答