2014-09-10 46 views
0

我在我的代码中遇到了一个错误,我无法在堆栈溢出问题上找到任何答案,所以我需要一些帮助。 here's我的代码预期标识符UIViewController

的H-文件

#import <UIKit/UIKit.h> 
#import "NewWalkViewController.h" 

@interface HomeViewController : UIViewController 


@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext; 

@end 

和here's M文件

#import "HomeViewController.h" 

@interface HomeViewController() 

@end 

@implementation HomeViewController 

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

{ 

    UIViewController *nextController = [segue destinationViewController]; 
    if ([nextController isKindOfClass:[NewWalkViewController]]) { 
     ((NewWalkViewController *) nextController).managedObjectContext = self.managedObjectContext; 

    } 

} 

@end 

我上了如果 - nextController线错误在m文件中

回答

0

你可能想修改你的if语句如下..

if ([nextController isKindOfClass:[NewWalkViewController class]]) { 

只需添加为NewWalkViewController类class方法,该方法将返回类对象

+0

MHM ..它解决了这个问题..谢谢!:) – Andy 2014-09-10 08:34:06

+0

如果是这样,请接受的答案。 :) – uiroshan 2014-09-10 08:34:49