Controller has no segue with identifier - ios

I connected my UITableViewController to a NavigationController with ctrl, defined the segue as "modal" and defined the segue identifier "DetailEvent".
In the class of my UITableViewController I added this code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(#"Row Selected = %i",indexPath.row);
[self performSegueWithIdentifier:#"DetailEvent" sender:self.view];
}
Error:
Row Selected = 1
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<AvailableEventsController: 0xa335500>) has no segue with identifier 'DetailEvent''
*** First throw call stack:
(0x175b012 0x1580e7e 0x5aa492 0xa6b53fa 0x103a0 0x5778d5 0x577b3d 0xf7ee83 0x171a376 0x1719e06 0x1701a82 0x1700f44 0x1700e1b 0x23ee7e3 0x23ee668 0x4c865c 0xbf7d 0x2755)
libc++abi.dylib: terminate called throwing an exception
What am I doing wrong here?

I was working on a different UIViewController in the StoryBoard.

Related

Overriding didSelectRowAtIndexPath on a framework-provided view controller?

So I'm using the CoreAudioKit's CABTMIDICentralViewController to present a list of MIDI Bluetooth devices for the user to select. However, I want to be able to tell which device the user selected when they're done, but it doesn't seem Apple has added any way to do that.
So I'm trying to hack it by detecting when the user selects a row in the table:
DPBleMidiDeviceManager.h:
#import <CoreAudioKit/CoreAudioKit.h>
#interface DPBleMidiDeviceManager : CABTMIDICentralViewController
#end
DPBleMidiDeviceManager.m:
#import "DPBleMidiDeviceManager.h"
#implementation DPBleMidiDeviceManager
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(#"midi device selected %#", indexPath);
//either of these next lines crash, it makes no difference:
//[[tableView delegate] tableView:tableView didDeselectRowAtIndexPath:indexPath];
[super tableView:tableView didDeselectRowAtIndexPath:indexPath];
}
#end
The problem is, it's crashing on the last line saying there's no selector. Which is weird, because if I remove the super call, it doesn't crash, but it also doesn't correctly connect to the BLE device, like it would if I was not overriding that delegate call.
Is this just something Apple does so you can't access their tables? Why would they build a UI view like this and let you call it, but not give you any information about what the result was? Am I missing some standard way to do this?
EDIT: here's the details of the crash with the super call:
2015-10-29 15:14:37.039 [626:338267] midi device selected <NSIndexPath: 0x1473ae20> {length = 2, path = 0 - 3}
2015-10-29 15:14:37.039 [626:338267] -[DPBleMidiDeviceManager tableView:didDeselectRowAtIndexPath:]: unrecognized selector sent to instance 0x147f34e0
2015-10-29 15:14:37.040 [626:338267] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DPBleMidiDeviceManager tableView:didDeselectRowAtIndexPath:]: unrecognized selector sent to instance 0x147f34e0'
*** First throw call stack:
(0x2b3cdfef 0x3967dc8b 0x2b3d3409 0x2b3d11bf 0x2b300e78 0xaa165 0x2eb3956b 0x2ebe843b 0x2ea9da91 0x2ea1838f 0x2b393fed 0x2b3916ab 0x2b391ab3 0x2b2de201 0x2b2de013 0x32aab201 0x2ea82a59 0x88447 0x39c09aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
That's not how you call super. It should be
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(#"midi device selected %#", indexPath);
[super tableView:tableView didDeselectRowAtIndexPath:indexPath];
}

Tableview and UIbutton simultaneously touchdownpress registered input order on which button is let loose first

The following problem occurs in my project, when i pressed and hold a backbutton (uibarbuttonitem) and a tableview row. And letting go the tableview row and followed by letting go the backbutton the following error occurs:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'.
I have figured out the problem here is that the tableview didselectrowatindexpath has wrong indexpath.
Case: A uibarbuttonitem and a tableview row is pressed and hold simultaneously.
In situation 1: The uibarbuttonitem is letting go and followed by letting go the tableview row.
Result: Selector for uibarbuttonitem is called. (In my case no error.)
In situation 2: The tableview row is letting go and followed by letting go the uibarbuttonitem.
Result: Selector for uibarbuttonitem is called and followed by the delegate methods of tableview. (In my case the error above occurs.)
- (void)backbutton {
self.itemList = [self getOldItem];
[self.tableView reloadData];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// It crash on this line.
Model *model = [[self.itemList objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
[model show];
}
Does anyone know if this is a normal behavior for which order the selector methods of those button are called? And how i should handle this?

Assertion failure in UITableView after registering nib

I ‘m trying to make a table programmatically. But when it dequeues it throws “unable to dequeue a cell with identifier…” exception. I have a custom cell in a nib and I am registering it in viewDidLoad as follows:
[self.myTable registerNib:[UINib nibWithNibName:#"MyCustomCell" bundle:nil] forCellReuseIdentifier:#"MyCustomCell"];
Later, while configuring the cell in tableView: cellForRowAtIndexPath it crashes dequeueing on:
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:#"MyCustomCell" forIndexPath:indexPath];
This is the stacktrace:
2015-03-04 23:15:06.296 MyApp[6470:3127630] *** Assertion failure in
-[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /SourceCache/UIKit/UIKit-3318.16.25/UITableView.m:6116 2015-03-04
23:15:06.299 MyApp[6470:3127630] *** Terminating app due to uncaught
exception 'NSInternalInconsistencyException', reason: 'unable to
dequeue a cell with identifier MyCustomCell - must register a nib or a
class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack: (0x2249149f 0x2ff49c8b 0x22491375 0x23162d1f 0x25ab503d 0x1026d3 0x25c17fb7 0x25c1807b 0x25c0d7d1
0x25a258ef 0x2594fa6f 0x25377a0d 0x253733e5 0x2537326d 0x25372c51
0x25372a55 0x2536c92d 0x22457d95 0x22455453 0x2245585b 0x223a33c1
0x223a31d3 0x297780a9 0x259b17b1 0x102cb1 0x304c9aaf) libc++abi.dylib:
terminating with uncaught exception of type NSException
I checked the identifier several times so I can’t figure out what can lead to that crash.
Could anyone shed light on it? Thanks in advance.

unrecognized selector sent to instance on ios table view cell click

I'm a very beginner to iOs. I'm going to view a list in table view controller. My application is a story board application. I did the following code to go to the next view.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
LawyerViewController *dvc = [self.storyboard instantiateViewControllerWithIdentifier:#"LawyerViewController"];
dvc.lawyer = #"Thisara";//[self.myObject objectAtIndex:indexPath.row];
[self.navigationController pushViewController:dvc animated:YES];
}
in my LawyerViewController header file I defined the following property.
#property (nonatomic, strong) NSString *lawyer;
When I'm clicking on the cell, I've got following error.
2014-07-26 23:56:14.420 lawyerapp[3626:60b] -[UIViewController setLawyer:]: unrecognized selector sent to instance 0x8cdd1f0
2014-07-26 23:56:14.424 lawyerapp[3626:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setLawyer:]:
unrecognized selector sent to instance 0x8cdd1f0'
How do I fix this.
Thanks in Advance!
You have not defined the class in storyBoard.
Go to your viewController in StoryBoard ->
than identity Inspector -> class -> Put the class LawyerViewController.
Clean,build and run

Add row to UITableViewController from child

I have UIViewController that performs a login check with the code below, and a UITableViewController as its parent controller. I'm trying to add another row to the UITableViewController after switching back to it, however I'm getting the following error:
[UINavigationController insertNewObject:]: unrecognized selector sent to instance 0x14de164d0
2014-03-08 17:00:27.379 MyApp[2562:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationController insertNewObject:]: unrecognized selector sent to instance 0x14de164d0'
-
if(loginSuccess)
{
[self.navigationController popViewControllerAnimated:YES];
[self.navigationController performSelector:#selector(insertNewObject:) withObject:#"Another Row"];
}
The method definition of insertNewObject is:
- (void)insertNewObject:(NSString *)name
{
if (!_objects) {
_objects = [[NSMutableArray alloc] init];
}
[_objects insertObject:name atIndex:0];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtIndexPaths:#[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
Can someone help me with what I'm doing wrong?
You're calling insertNewObject on a UINavigationController not your UITableViewController.
Try creating a property on your UIViewController that points to the original TableViewController and calling it through the property. Or calling it when the TableViewController reappears.

Resources