NSIndexPath does not recognize item, section, or row as properties

ios, nsindexpath, uicollectionview, uicollectionviewcell

Solution

Do not use the getter/setter dot syntax, use brackets:

- `po (int)[index row]`

- `po (int)[index section]`

Note that the `(int)` is necessary to print the row/section as an integer rather than a hex. Other such useful formatting parameters for LLDB can be found here.

EDIT

The Swift overlay to the Foundation framework provides the IndexPath structure, which bridges to the NSIndexPath class. The IndexPath value type offers the same functionality as the NSIndexPath reference type, and the two can be used interchangeably in Swift code that interacts with Objective-C APIs. This behavior is similar to how Swift bridges standard string, numeric, and collection types to their corresponding Foundation classes.

- `po index.row`

- `po index.section`

work as expected. The comment on `p` vs. `po` still stands.

It is worth noting that you may use `IndexPath` in Swift instead of NSIndexPath, as described in the Apple Documentation.

Problem

When iOS 7.1 sends my viewController: ``` - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath ``` The indexPath object does not recognize the properties: item, section or row. The expected values are section = 0, item = 0 The Debugger shows: ``` **indexPath NSIndexPath * 0xc000000000000016 NSObject _indexes NSUInteger * NULL *_indexes _length _reserved void * NULL ``` The log reports: ``` (lldb) po indexPath <NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0} (lldb) po indexPath.item error: property 'item' not found on object of type 'NSIndexPath *' error: 1 errors parsing expression (lldb) po indexPath.row error: property 'row' not found on object of type 'NSIndexPath *' error: 1 errors parsing expression (lldb) po indexPath.section error: property 'section' not found on object of type 'NSIndexPath *' error: 1 errors parsing expression**** ``` Any ideas why this is happening and what to do about it?

Original source