本文介绍了[UINavigationController setGoalName:]:无法识别的选择器发送到实例0x7964e2c0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码创建了应用。它与iOS7配合使用,但是当我使用iOS8运行时它会抛出以下错误。

I have created the app with following code. Its working fine with iOS7 but it throws the below error when I run with iOS8.

[UINavigationController setGoalName:]: unrecognized selector sent to instance 0x7964e2c0

我的firstViewcontroller.m

My firstViewcontroller.m

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

GoalDetailsViewController *goalsDetailsViewController = segue.destinationViewController;
NSLog(@"%@",[NSString stringWithFormat:@"%@", [[self.arrCategoryTitle objectAtIndex:indexPath.row] objectAtIndex:indexOfCategory]]);
goalsDetailsViewController.goalName = @"Exercise Daily";

}

我的GoalDetailsViewController.h

My GoalDetailsViewController.h

@interface GoalDetailsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic) NSString *goalName;

提前致谢。

推荐答案

好像你的destinationviewcontroller是UINAvigationController的子类。

Seems like your destinationviewcontroller is a subclass of UINAvigationController.

试试这个:

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

GoalDetailsViewController *goalsDetailsViewController = [(UINavigationController*)segue.destinationViewController topViewController];
NSLog(@"%@",[NSString stringWithFormat:@"%@", [[self.arrCategoryTitle objectAtIndex:indexPath.row] objectAtIndex:indexOfCategory]]);
goalsDetailsViewController.goalName = @"Exercise Daily";

}

这篇关于[UINavigationController setGoalName:]:无法识别的选择器发送到实例0x7964e2c0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 12:41