2014-09-10 45 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