Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8332841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:50:12+00:00 2026-06-09T02:50:12+00:00

I am trying to pass an object from one view controller to another but

  • 0

I am trying to pass an object from one view controller to another but it gives an error which is

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MapViewController setTMode:]: unrecognized selector sent to instance 0x866ed70'
*** First throw call stack:
(0x250b022 0x2709cd6 0x250ccbd 0x2471ed0 0x2471cb2 0x28044 0x250ce99 0x155c14e 0x155c0e6 0x1602ade 0x1602fa7 0x1602266 0x15813c0 0x15815e6 0x1567dc4 0x155b634 0x2c0bef5 0x24df195 0x2443ff2 0x24428da 0x2441d84 0x2441c9b 0x2c0a7d8 0x2c0a88a 0x1559626 0x261d 0x2595)
terminate called throwing an exception

my method for the .h file is

@interface TransportViewController : UIViewController<UITextFieldDelegate>
{
    MapViewController *modeData;
    MapViewController *walkDistData;
    MapViewController *routeOptData;
    IBOutlet UITextField *tbMode;
    IBOutlet UITextField *tbWalkDist;
    IBOutlet UITextField *tbRouteOpt;
    IBOutlet UIPickerView *pickerView;
    NSMutableArray *modeArray;
    UITextField *activeField;
    IBOutlet UIButton *back;
}    

@property (retain, nonatomic) MapViewController *modeData;
@property (retain, nonatomic) MapViewController *walkDistData;
@property (retain, nonatomic) MapViewController *routeOptData;
@property (retain, nonatomic) IBOutlet UITextField *tbMode;
@property (retain, nonatomic) IBOutlet UITextField *tbWalkDist;
@property (retain, nonatomic) IBOutlet UITextField *tbRouteOpt;
@property (retain, nonatomic) IBOutlet UIButton *back;

- (IBAction) backAction:(id)sender;
@end

and this is the method i have for my .m file

- (void)viewDidLoad
{
    [super viewDidLoad];
    tbMode.delegate = self;
    tbWalkDist.delegate = self;
    tbRouteOpt.delegate = self;     
}
- (IBAction) backAction:(id)sender
{
    MapViewController *view=[[MapViewController alloc] initWithNibName:nil bundle:nil];
    self.modeData = view;
    self.walkDistData = view;
    self.routeOptData = view;
    // NSLog(@"%@", modeData); // this is where i test all the NSLog at
    modeData.tMode = tbMode.text;
    NSString *str = [tbWalkDist text];
    walkDistData.tWalkDist = [str intValue];
    routeOptData.tRouteOpt = tbRouteOpt.text;
    [self presentModalViewController:view animated:NO];

}

the error is caught in these lines

modeData.tMode = tbMode.text;
NSString *str = [tbWalkDist text];
walkDistData.tWalkDist = [str intValue];
routeOptData.tRouteOpt = tbRouteOpt.text;

I put a NSLog(@"%@", modeData); to check the values, it returns <MapViewController: 0x84627a0>

and NSLog(@"%@", tbMode.text); it return me the values A which is what I need.

*the error is with modeData.tMode & walkDistData.tWalkDist & routeOptData.tRouteOpt

What did I do wrong ? Please help . I can’t seem to figure this one out

My second view controller .h

@interface MapViewController : UIViewController
{
    NSString *tMode;
    NSString *tRouteOpt;
    int tWalkDist;
} 
@property(nonatomic, retain)NSString *tMode;
@property(nonatomic, retain)NSString *tRouteOpt;
@property(nonatomic)int tWalkDist;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:50:14+00:00Added an answer on June 9, 2026 at 2:50 am

    You need to synthesize the tMode property in MapViewController.m:

    @implementation MapViewController
    
    @synthesize tMode;
    
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass an object from one controller action to another. The object
I'm trying to pass a struct from one object to another. I have the
I'm trying to pass a variable from one function to another, but the var
I am trying to pass an object from one page to another page where
I'm trying to pass a business object from one WinForm to another WinForm for
I'm trying to pass a variable from my main swf to another one that's
I'm trying to pass a list from one form class to another. Here's the
I'm trying to pass post data from one page to the next but PreviousPage
I am getting this error when trying to pass my object to the view.
I get an error trying to send a string from one window to another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.