使用可达性时收到警告

| 我的Apple可达性课程遇到问题。我从AppDelate成功地使用了它,但是当我尝试从另一个视图控制器类中使用它时,尽管仍然可以使用,但在下面得到了警告。 任何帮助表示赞赏。 q
//  MyViewController.m

#import \"Reachability.h\"

- (void) viewDidLoad {

    [[NSNotificationCenter defaultCenter] addObserver: self 
        selector: @selector(reachabilityChangedState:) 
        name: kReachabilityChangedNotification 
        object: nil];
}

- (void) reachabilityChangedState: (NSNotification* )note {                                     

    // Called by Reachability whenever status changes

    Reachability* curReach = [note object];
    NSParameterAssert([curReach isKindOfClass: [Reachability class]]);

    // HERE I GET THE FOLLOWING WARNING: \'MyViewController\' may not respond to \'-updateViewWithReachability.\' 
    [self updateViewWithReachability: curReach];    
}

- (void) updateViewWithReachability: (Reachability*) curReach {
    ...  // do my thing with controls
}
    
已邀请:
我认为您必须将方法放置在而不是下面的reachabilityChangedState方法上方,以使其能够被识别。 如果这样做没有帮助,请尝试将以下内容放在.h文件中: -(void)updateViewWithReachability:(Reachability *)curReach;     

要回复问题请先登录注册