我收到此错误:没有可见的@interface 可访问性声明选择器 startNotifier
我已经包含了 Reachability.h 和 .m 文件。我对 Objective-C 非常陌生,错误可能真的很小!但任何帮助都会很棒!
我的 helloworldViewController.m
#import "helloworldViewController.h"
#import "Reachability.h"
#import <SystemConfiguration/SystemConfiguration.h>
@interface helloworldViewController ()
@end
@implementation helloworldViewController
@synthesize networkstatus;
@synthesize reach;
#pragma mark Reachability changed
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Check network
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
self.reach = [Reachability reachabilityWithHostName:@"www.apple.com"];
[self.reach startNotifer];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)reachabilityChanged:(NSNotification*)note
{
Reachability* r = [note object];
NetworkStatus ns = r.currentReachabilityStatus;
if (ns == NotReachable)
{
NSString* msg = @"Network problems have rendered the iTunes store inaccessible; please try again later.";
UIAlertView* av = [[UIAlertView alloc] initWithTitle:nil
message:msg
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[av show];
//[av release];
}
}
@end
这是我的 helloworldViewController.h
#import <UIKit/UIKit.h>
#import "Reachability.h"
@interface helloworldViewController : UIViewController{
Reachability* reach;
IBOutlet UILabel *networkstatus;
}
@property(strong,nonatomic) UILabel *networkstatus;
@property (nonatomic, retain) Reachability* reach;
@end