Hi
I'm trying to implement reachability into my iPhone app to allow me to determine if the user has an internet connection. Unfortunately, I am getting two errors whilst trying to build the app. These are the steps I took to implement it:
I added the SystemConfiguration framework and added Reachability.h/.m to my classes folder.
I then added this to my viewcontroller.h file for the viewcontroller in which I am detecting an internet connection:
And then when I want to check if I am connected to the internet, I call this:
Unfortunately, when I build, I get the following two errors:
where the stuff in bold, underline and italics is the stuff in red in the error log, and hence the name of the bug.
I've no idea what's going on - something I've done wrong with my frameworks and architecture settings maybe?
Any help is much appreciated,
Thanks in advance,
Sam
I'm trying to implement reachability into my iPhone app to allow me to determine if the user has an internet connection. Unfortunately, I am getting two errors whilst trying to build the app. These are the steps I took to implement it:
I added the SystemConfiguration framework and added Reachability.h/.m to my classes folder.
I then added this to my viewcontroller.h file for the viewcontroller in which I am detecting an internet connection:
Code:
//Class.h
#import "Reachability.h"
#import <SystemConfiguration/SystemConfiguration.h>
- (BOOL)connected ;
Code:
In my .m file, I use this code as a boolean method, which when run will return if the user has an internet connection:
- (BOOL)connected
{
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [reachability currentReachabilityStatus];
return !(networkStatus == NotReachable);
}
And then when I want to check if I am connected to the internet, I call this:
Code:
if(![self connected])
{
// not connected
} else
{
// connected, do some internet stuff
}
Code:
Ld /Users/Samuel/Library/Developer/Xcode/DerivedData/Funny_Maths-ctillajbcxujxhdywykbwodfufrw/Build/Products/Debug-iphonesimulator/reactionfree.app/reactionfree normal i386
cd "/Users/Samuel/Documents/Projects/Apps/Funny Math Reachability"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/Samuel/Library/Developer/Xcode/DerivedData/Funny_Maths-ctillajbcxujxhdywykbwodfufrw/Build/Products/Debug-iphonesimulator "-L/Users/Samuel/Documents/Projects/Apps/Funny Math Reachability/GoogleAdMobAdsSDKiOS-5.0.5" -F/Users/Samuel/Library/Developer/Xcode/DerivedData/Funny_Maths-ctillajbcxujxhdywykbwodfufrw/Build/Products/Debug-iphonesimulator -filelist "/Users/Samuel/Library/Developer/Xcode/DerivedData/Funny_Maths-ctillajbcxujxhdywykbwodfufrw/Build/Intermediates/Funny Maths.build/Debug-iphonesimulator/Funny Maths.build/Objects-normal/i386/reactionfree.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework SystemConfiguration -framework QuartzCore -framework iAd -lsqlite3 -lz -framework MapKit -framework CoreLocation -framework AVFoundation -framework AddressBook -framework MessageUI -framework AudioToolbox -framework Foundation -framework UIKit -framework CoreGraphics -lGoogleAdMobAds -o /Users/Samuel/Library/Developer/Xcode/DerivedData/Funny_Maths-ctillajbcxujxhdywykbwodfufrw/Build/Products/Debug-iphonesimulator/reactionfree.app/reactionfree
Undefined symbols for architecture i386:
[B][I][U]"_OBJC_CLASS_$_Reachability", referenced from:[/U][/I][/B]
objc-class-ref in RssFunViewController.o
ld: symbol(s) not found for architecture i386
clang: error: [B][I][U]linker command failed with exit code 1 (use -v to see invocation)[/U][/I][/B]
where the stuff in bold, underline and italics is the stuff in red in the error log, and hence the name of the bug.
I've no idea what's going on - something I've done wrong with my frameworks and architecture settings maybe?
Any help is much appreciated,
Thanks in advance,
Sam