4

when i worked with slide out menu using SWRevealViewController class ,it works correctly in iphone simulator.But when i tried to run in the iphone 5 device for testing,while selecting the menu button it shows the slide out menu properly, but unfortunately,while selecting the cells ,it crashes and shows the following error.but no such errors in simulator.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    indexPath = [[self tableView] indexPathForSelectedRow];
    if (indexPath.row==0) {

        [self performSegueWithIdentifier:@"home" sender:indexPath];

    }
  else if (indexPath.row==1) {

        [self performSegueWithIdentifier:@"cartme" sender:indexPath];

    }
   else {

        [self performSegueWithIdentifier:@"changelocation" sender:indexPath];

    }
}

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SWRevealViewControllerSegue setDestinationContainmentContext:]: unrecognized selector sent to instance 0x175c5f90'

please help me.

Tharif
  • 13,794
  • 9
  • 55
  • 77
Abdul Nouzil
  • 373
  • 1
  • 3
  • 9

2 Answers2

6

I had same problem, I fixed it by changing segue type to "Custom" instead of "Push"

Sadia
  • 462
  • 1
  • 5
  • 13
0

Add more information based on this iOS open source codes.

It is obvious, that setDestinationContainmentContext is a method for push segue. So, the custom segue should choose Custom segue type, not Push.

Subclass from UIStoryboardSegue has no such method, so it crashes.

/* Generated by RuntimeBrowser
   Image: /System/Library/Frameworks/UIKit.framework/UIKit
 */

@interface UIStoryboardPushSegueTemplate : UIStoryboardSegueTemplate {
    int  _destinationContainmentContext;
    int  _splitViewControllerIndex;
}

@property (nonatomic) int destinationContainmentContext;
@property (nonatomic) int splitViewControllerIndex;

- (int)destinationContainmentContext;
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id /* block */)newDefaultPerformHandlerForSegue:(id)arg1;
- (void)setDestinationContainmentContext:(int)arg1;
- (void)setSplitViewControllerIndex:(int)arg1;
- (int)splitViewControllerIndex;

@end
AechoLiu
  • 17,522
  • 9
  • 100
  • 118