0

我刚开始使用NSOrderedSetCore Data,我尝试添加的第一个对象失败了。我发现这篇描述失败的帖子: NSOrderedSet 生成的访问器中抛出的异常

现在我想删除特定索引处的对象。当我调用生成的核心数据方法时,我将无法识别的选择器发送到实例。对我来说,它看起来像:

removeObjectFromAddressAnnotationsAtIndex:

我想知道我是否做错了什么,或者这个生成的方法是否也存在错误。当我通过时,我看到我的索引确实符合我的预期,所以我不确定它是什么。

编辑:

我像这样使用它:

[_route removeAddressAnnotationsAtIndexes:[NSIndexSet indexSetWithIndex:indexToRemove]];
[_route removeObjectFromAddressAnnotationsAtIndex:indexToRemove];

我都试过了,都失败了这个错误:

[Route removeAddressAnnotationsAtIndexes:]: unrecognized selector sent to instance 0xea71980
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Route removeAddressAnnotationsAtIndexes:]: unrecognized selector sent to instance 0xea71980'
4

1 回答 1

1

我已经基本放弃了NSOrderedSet。它们既不是来自NSArray也不是来自,有点笨拙NSSet,所以很多常用的功能根本不可用。

在我的核心数据模型中,我包含了一个positionororder属性来跟踪订单。简单可靠。

于 2013-09-30T09:54:55.780 回答