cellForRowAtIndexPath nil during unit tests
Instantiate an actual UITableViewController
and this works fine.
cellForRowAtIndexPath: crashes when trying to access arrays objectAtIndex:indexPath.row
The actual error is this:
-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x5d10c20
In other words, you tried to run objectAtIndex:
on an NSString
(NSCFString
), which of course does not support this method.
You call objectAtIndex:
three times, in these lines:
cell.titleLabel.text = [postsArrayTitle objectAtIndex:indexPath.row];
cell.dateLabel.text = [postsArrayDate objectAtIndex:indexPath.row];
cell.cellImage.image = [UIImage imageWithContentsOfFile:[postsArrayImg objectAtIndex:indexPath.row]];
So it appears that postsArrayTitle
, postsArrayDate
, or postsArrayImg
isn't an NSArray
, but an NSString
.
Related Topics
Updated Approach to Reauthenticate a User
What the Difference of Keys and Values in Dictionary of Swift
Calling a Child Inside 2 Levels of Nodes
Could Not Cast Value of Type Uiview to [Customview] Using Xib
When Two Optionals Are Assigned to an If Let Statement, Which One Gets Unwrapped? Swift Language
Label Showing Top of Screen Instead of Being on the Inputaccessoryview
Show Datepicker Hourandminute on Print Statement Swiftui
Sending Variables with a Segue
Thread 1: Signal Sigabrt Error When Using Ibactions
Using the Swift If Let with Logical and Operator &&
Custom Cell with Uitableview Inside Uicollectionviewcell
Unexpected Non-Void Return Value in Void Function Swift 4 Using JSON Serialisation
Disable Email Detection in Swiftui's Text
Change Mkmarkerannotationview Size
App Window on Top of All Windows Including Others App Windows
Value of Optional Type 'Nsurl' Not Unwrapped; Did You Mean to Use '!' or ''