Apple Mach-O Linker (Id) Error with Reachability
ios, mach-o, objective-c, reachability, xcode
Solution
You need to add `Reachability.m` to your target's "Compile Sources" build phase.
One way to do it:
- Select `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.
- Show the file inspector on the right side of the Xcode window. View > Utilities > Show File Inspector.
- In the Target Membership section, check the checkbox next to your target.
Problem
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