I keep getting this error when I try to build my project which uses reachability (the error only came up after I tried to implement reachability):
I read some other posts on the internet but nothing seemed to work. I added SystemConfiguration.framework (project, build phases, +), but that didn't work (I had already added it when the error came up). Here's how I implement the files:
#import <UIKit/UIKit.h>
#import "Reachability.h"
@interface catalogDetailView : UIViewController{
}
-(void)checkNetwork;
@end
Then in the .m:
#import "catalogDetailView.h"
-(void)checkNetwork{
if ([self reachable]) {
NSLog(@"Connected to Network");
}
else {
NSLog(@"Connection Failed");
}
}
-(BOOL)reachable {
Reachability *r = [Reachability reachabilityWithHostName:@"apple.com"];
NetworkStatus internetStatus = [r currentReachabilityStatus];
if(internetStatus == NotReachable) {
return NO;
}
return YES;
}
So if you could help that would be amazing!! Thanks ;) Luke
You need to add Reachability.m
to your target's "Compile Sources" build phase.
One way to do it:
Reachability.m
in the project navigator, on the left side of the Xcode window. If you don't see it, choose the menu View > Navigators > Show Project Navigator.