目标 C - 按钮无法按下 VC

ObjectiveC - Button can't push to a VC

我有一个 VC 和 3 buttons。我完成映射 1st button 以推送到 VC1。当我尝试映射 2nd button 以推送到 VC2 时,我的程序崩溃了。为了调试,我创建了一个简单的按钮来推送到一个空 VC。它也崩溃了。我不知道发生了什么。 3rd button 不会推送到 ny VC

我的故事板

我的代码

@synthesize btnEditProfile;
@synthesize btnChgLang;
@synthesize btnLogOut;

- (void)viewDidLoad {
    [super viewDidLoad];

    //=== Customize the btn
    btnEditProfile.layer.cornerRadius =7.0f;
    btnEditProfile.layer.shadowRadius = 3.0f;
    btnEditProfile.layer.shadowColor = [UIColor blackColor].CGColor;
    btnEditProfile.layer.shadowOffset = CGSizeMake(0.0f, 2.0f);
    btnEditProfile.layer.shadowOpacity = 0.5f;
    btnEditProfile.layer.masksToBounds = NO;

    //=== Customize the btn
    btnChgLang.layer.cornerRadius =7.0f;
    btnChgLang.layer.shadowRadius = 3.0f;
    btnChgLang.layer.shadowColor = [UIColor blackColor].CGColor;
    btnChgLang.layer.shadowOffset = CGSizeMake(0.0f, 2.0f);
    btnChgLang.layer.shadowOpacity = 0.5f;
    btnChgLang.layer.masksToBounds = NO;

//=== Customize the btn
btnLogOut.layer.cornerRadius =7.0f;
btnLogOut.layer.shadowRadius = 3.0f;
btnLogOut.layer.shadowColor = [UIColor blackColor].CGColor;
btnLogOut.layer.shadowOffset = CGSizeMake(0.0f, 2.0f);
btnLogOut.layer.shadowOpacity = 0.5f;
btnLogOut.layer.masksToBounds = NO;
}


- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    ProfileEdit *target = segue.destinationViewController;

    if ([segue.identifier isEqualToString:@"EditProfile"]) {

        target.dataFromProfile = profileData;

    } else {

        target.dataFromProfile = profileData;
    }
}


- (IBAction)btnEditProfile:(id)sender {

    [self performSegueWithIdentifier:@"EditProfile" sender:self]; 
}

- (IBAction)btnChgLang:(id)sender {

    NSLog(@"What is going on ? ");

    //[self performSegueWithIdentifier:@"ChangeLang" sender:self];
}


- (IBAction)btnLogOut:(id)sender {

    User *userObj = [[User alloc] init];
    [userObj logout];

    //AppDelegate *authObj = (AppDelegate*)[[UIApplication sharedApplication] delegate];
//authObj.authenticated = YES;

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

    RootViewController *initView =  (RootViewController*)[storyboard instantiateViewControllerWithIdentifier:@"RootNavigationControllerID"];
    [initView setModalPresentationStyle:UIModalPresentationFullScreen];
    [self presentViewController:initView animated:NO completion:nil];

}

错误

  2018-04-19 17:47:10.846656+0800 SFITNESS[53692:4752813] -[UIViewController setDataFromProfile:]: unrecognized selector sent to instance 0x7fb2f7f8e490
  2018-04-19 17:47:10.867342+0800 SFITNESS[53692:4752813] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setDataFromProfile:]: unrecognized selector sent to instance 0x7fb2f7f8e490'
  *** First throw call stack:

你的问题就在这里

target.dataFromProfile = profileData;

作为目的地之一

ProfileEdit *target = segue.destinationViewController;

不包含变量

dataFromProfile