以 iOS 5.0 为目标,当我尝试在以下代码中访问 NSIndexPath 对象的行或部分属性时,我看到了 SIGABRT:
NSIndexPath* path = [[NSIndexPath alloc] initWithIndex:0];
int row = path.row; //SIGABRT
int section = path.section;//SIGABRT
这个例子建议使用 indexPathWithIndex: 代替http://developer.apple.com/library/mac/#samplecode/SourceView/Listings/BaseNode_m.html#//apple_ref/doc/uid/DTS10004441-BaseNode_m-DontLinkElementID_6
path = [NSIndexPath indexPathWithIndex:0];
结果保持一致。有没有人解释为什么会发生这种情况?是不是我们不能在 iOS 5.0 中对 NSIndexPath 进行操作?
提前致谢。