I have an instance variable _sessions of type NSArray. Throughout the TableViewController methods, I access it and it is fine. But when in prepareForSegue, I try to access it or its values, it throws this error..
Relavent code:
@interface SessionsTVC()
{
NSArray *_sessions;
JSONDataRetriever *jsonRetriever;
NSString *requestURL;
}
@end
in @implementation:
_sessions = [[NSArray alloc]initWithArray:_tempArray];
Lines giving me trouble:
NSLog([_sessions objectAtIndex:1]);
or
NSLog(_sessions);
What is even weirder is that this works:
NSLog([@(_sessions.count) stringValue]);
EDIT:
NSLog([@(_sessions.count) stringValue]); gives me back 2 (which is exactly right)..
FULL ERROR MESSAGE
2014-08-13 23:14:46.548 ReadDatabase[15142:650918] -[Session length]: unrecognized selector sent to instance 0x7fb5fbf55090 2014-08-13 23:14:46.644 ReadDatabase[15142:650918] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Session length]: unrecognized selector sent to instance 0x7fb5fbf55090' * First throw call stack: ( 0 CoreFoundation 0x00000001074313e5 exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001070e1967 objc_exception_throw + 45 2 CoreFoundation 0x00000001074384fd -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x00000001073907ec ___forwarding_ + 988 4 CoreFoundation 0x0000000107390388 _CF_forwarding_prep_0 + 120 5 CoreFoundation 0x000000010732a39b CFStringAppendFormatCore + 235 6 CoreFoundation 0x0000000107411c00 _CFStringCreateWithFormatAndArgumentsAux2 + 256 7 CoreFoundation 0x0000000107420a4f _CFLogvEx2 + 127 8 Foundation 0x0000000106c7da22 NSLogv + 99 9 Foundation 0x0000000106c7d9a7 NSLog + 148 10 ReadDatabase 0x00000001054a36f6 -[SessionsTVC prepareForSegue:sender:] + 518 11 UIKit 0x0000000105f04716 -[UIStoryboardSegueTemplate _perform:] + 151 12 UIKit 0x0000000105aa0d40 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1242 13 UIKit 0x0000000105aa0eb4 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219 14 UIKit 0x00000001059dc97e _applyBlockToCFArrayCopiedToStack + 314 15 UIKit 0x00000001059dc7f8 _afterCACommitHandler + 516 16 CoreFoundation 0x0000000107366337 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 17 CoreFoundation 0x0000000107366290 __CFRunLoopDoObservers + 368 18 CoreFoundation 0x000000010735c0c3 __CFRunLoopRun + 1123 19 CoreFoundation 0x000000010735b9f6 CFRunLoopRunSpecific + 470 20 GraphicsServices 0x000000010960c9f0 GSEventRunModal + 161 21 UIKit 0x00000001059b9990 UIApplicationMain + 1282 22 ReadDatabase 0x00000001054a2bf3 main + 115 23 libdyld.dylib 0x0000000109def145 start + 1 24 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)