├── .gitignore ├── LICENSE ├── README.md ├── SDReachability.h ├── SDReachability.m ├── SDReachability.xcodeproj └── project.pbxproj └── SDReachabilityDemo ├── AppDelegate.h ├── AppDelegate.m ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── SDReachabilityDemo-Info.plist ├── SDReachabilityDemo-Prefix.pch ├── ViewController.h ├── ViewController.m ├── en.lproj ├── InfoPlist.strings └── ViewController.xib └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Xcode 4 | build/* 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | *.xcworkspace 14 | !default.xcworkspace 15 | xcuserdata 16 | profile 17 | *.moved-aside -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Olivier Poitrey 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SDReachability 2 | 3 | SDReachability is a lightweight rewrite of Apple's Reachability example library focused on easy embedability and usage simplicity. 4 | 5 | Most network based library needs Reachability feature but can't embed the Apple implementation without taking the risk to name class with the same library embeded by another library or the hosted app itself. SDReachability solve this issue by letting embeders easily modify symbols exported by the library by adding their own prefix. Additionnaly, SDReachability doesn't relies on global NSNotification but uses target/action pattern. 6 | 7 | SDReachability API is revisited in order to be simpler to use. You just have to instanciate it and give it a target object with an action selector. You must store the resulting instance. You don't have to start/stop the notif(i)er, it's started immediatly after initialization and is stopped as soon as its instance is deallocated — which should happen when the host object will be deallocated itself. 8 | 9 | ## Installation 10 | 11 | - Copy the .h/.m files into your project 12 | - In you application project application's target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block 13 | - Click the "+" button again and select the `SystemConfiguration.framework` 14 | 15 | ## Usage 16 | 17 | Check if Internet is reachable: 18 | 19 | SDReachability *reach = SDReachability.new; 20 | if (reach.isReachable) 21 | { 22 | NSLog(@"Connected with %@", reach.isReachableViaWWAN ? @"3G" : @"WiFi"); 23 | } 24 | else 25 | { 26 | NSLog(@"Not Connected"); 27 | } 28 | 29 | Subscribe to connectivity changes 30 | 31 | @interface MyObject () 32 | 33 | @property (strong, nonatomic) SDReachability *reachability; 34 | 35 | @end 36 | 37 | 38 | @implementation MyObject 39 | 40 | - (void)monitorReachability 41 | { 42 | self.reachability = [SDReachability reachabilityWithTarget:self action:@selector(reachabilityChanged:)]; 43 | } 44 | 45 | - (void)reachabilityChanged:(SDReachability *)reachability 46 | { 47 | switch (reachability.reachabilityStatus) 48 | { 49 | case SDNotReachable: 50 | NSLog(@"Connection lost"); 51 | break; 52 | 53 | case SDReachableViaWiFi: 54 | NSLog(@"Connected via WiFi"); 55 | break; 56 | 57 | case SDReachableViaWWAN: 58 | NSLog(@"Connected via WWAN"); 59 | break; 60 | } 61 | } 62 | 63 | @end 64 | 65 | ## Embedding 66 | 67 | If you want to distribute a static library with reachability support, it's a bad idea to just copy the Apple provided Reachability demo class. Chances are that your users will already use this class either directly or through another library, leading to name claching and compilation headache. 68 | 69 | SDReachability helps you with embedding by providing an easy way to rename all exported symbols so they won't clash. To embed SDReachability into your project, copy the .h and .m files and modify the `#define` instructions at the top of the .h file like this: 70 | 71 | #undef $SDReachability 72 | #define $SDReachability MyLibraryReachability 73 | #undef $SDReachabilityStatus 74 | #define $SDReachabilityStatus MyLibraryReachabilityStatus 75 | #undef $SDNotReachable 76 | #define $SDNotReachable MyLibraryNotReachable 77 | #undef $SDReachableViaWiFi 78 | #define $SDReachableViaWiFi MyLibraryReachableViaWiFi 79 | #undef $SDReachableViaWWAN 80 | #define $SDReachableViaWWAN MyLibraryReachableViaWWAN 81 | 82 | In your library, use MyLibraryReachability instead of SDReachability, same for all other redefined symboles. 83 | 84 | ## License 85 | 86 | All source code is licensed under the [MIT License](https://raw.github.com/rs/SDReachability/master/LICENSE). 87 | -------------------------------------------------------------------------------- /SDReachability.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Olivier Poitrey 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is furnished 9 | * to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in all 12 | * copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | // Here you can redefine symbols exported by this library so it doesn't clash with 24 | // other library or the host app that would embed its own reachability library. 25 | // You may use the full name of you library as a prefix. 26 | #undef $SDReachability 27 | #define $SDReachability SDReachability 28 | #undef $SDReachabilityStatus 29 | #define $SDReachabilityStatus SDReachabilityStatus 30 | #undef $SDNotReachable 31 | #define $SDNotReachable SDNotReachable 32 | #undef $SDReachableViaWiFi 33 | #define $SDReachableViaWiFi SDReachableViaWiFi 34 | #undef $SDReachableViaWWAN 35 | #define $SDReachableViaWWAN SDReachableViaWWAN 36 | 37 | #import 38 | #import 39 | 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #import 46 | 47 | typedef enum 48 | { 49 | $SDNotReachable = 0, 50 | $SDReachableViaWiFi, 51 | $SDReachableViaWWAN 52 | } $SDReachabilityStatus; 53 | 54 | @interface $SDReachability : NSObject 55 | 56 | @property (assign, nonatomic, readonly) SCNetworkReachabilityFlags reachabilityFlags; 57 | @property (assign, nonatomic, readonly) $SDReachabilityStatus reachabilityStatus; 58 | 59 | @property (assign, nonatomic, readonly, getter=isReachable) BOOL reachable; 60 | @property (assign, nonatomic, readonly, getter=isReachableViaWWAN) BOOL reachableViaWWAN; 61 | @property (assign, nonatomic, readonly, getter=isReachableViaWiFi) BOOL reachableViaWiFi; 62 | 63 | /** 64 | * WWAN may be available, but not active until a connection has been established. 65 | * WiFi may require a connection for VPN on Demand. 66 | */ 67 | @property (assign, nonatomic, readonly, getter=isConnectionRequired) BOOL connectionRequired; 68 | @property (assign, nonatomic, readonly, getter=isConnectionOnDemand) BOOL connectionOnDemand; 69 | /** 70 | * Is user intervention required? 71 | */ 72 | @property (assign, nonatomic, readonly, getter=isInterventionRequired) BOOL interventionRequired; 73 | 74 | + ($SDReachability *)reachability; 75 | + ($SDReachability *)reachabilityWithHostname:(NSString*)hostname; 76 | + ($SDReachability *)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress; 77 | 78 | + ($SDReachability *)reachabilityWithTarget:(id)target action:(SEL)action; 79 | + ($SDReachability *)reachabilityWithHostname:(NSString *)hostname target:(id)target action:(SEL)action; 80 | + ($SDReachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress target:(id)target action:(SEL)action; 81 | 82 | - (void)setTarget:(id)target action:(SEL)action; 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /SDReachability.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Olivier Poitrey 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is furnished 9 | * to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in all 12 | * copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifdef __OBJC_GC__ 24 | #error SDReachability does not support Objective-C Garbage Collection 25 | #endif 26 | 27 | #if !__has_feature(objc_arc) 28 | #error SDReachability is ARC only. Either turn on ARC for the project or use -fobjc-arc flag on this file 29 | #endif 30 | 31 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 32 | #error SDReachability doesn't support Deployement Target version < 5.0 33 | #endif 34 | 35 | #import "SDReachability.h" 36 | #import 37 | 38 | @interface $SDReachability () 39 | 40 | @property (assign, nonatomic) SCNetworkReachabilityRef reachabilityRef; 41 | @property (assign, nonatomic, readwrite) SCNetworkReachabilityFlags reachabilityFlags; 42 | @property (weak, nonatomic) id target; 43 | @property (assign, nonatomic) SEL action; 44 | 45 | @end 46 | 47 | @implementation $SDReachability 48 | 49 | + ($SDReachability *)reachability 50 | { 51 | return self.new; 52 | } 53 | 54 | + ($SDReachability *)reachabilityWithTarget:(id)target action:(SEL)action 55 | { 56 | $SDReachability *reachability = self.new; 57 | [reachability setTarget:target action:action]; 58 | return reachability; 59 | } 60 | 61 | + ($SDReachability *)reachabilityWithHostname:(NSString*)hostname 62 | { 63 | SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]); 64 | return ref ? [self.alloc initWithReachabilityRef:ref] : nil; 65 | } 66 | 67 | + ($SDReachability *)reachabilityWithHostname:(NSString*)hostname target:(id)target action:(SEL)action 68 | { 69 | $SDReachability *reachability = [self reachabilityWithHostname:hostname]; 70 | [reachability setTarget:target action:action]; 71 | return reachability; 72 | } 73 | 74 | + ($SDReachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress 75 | { 76 | SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)hostAddress); 77 | return ref ? [[self alloc] initWithReachabilityRef:ref] : nil; 78 | } 79 | 80 | + ($SDReachability *)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress target:(id)target action:(SEL)action 81 | { 82 | $SDReachability *reachability = [self reachabilityWithAddress:hostAddress]; 83 | [reachability setTarget:target action:action]; 84 | return reachability; 85 | } 86 | 87 | static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info) 88 | { 89 | #pragma unused (target, flags) 90 | // We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively 91 | // in case someon uses the Reachablity object in a different thread. 92 | @autoreleasepool 93 | { 94 | __strong $SDReachability *reachability = ((__bridge $SDReachability *)info); 95 | if (reachability) 96 | { 97 | objc_msgSend(reachability.target, reachability.action, reachability); 98 | } 99 | } 100 | } 101 | 102 | - (id)init 103 | { 104 | struct sockaddr_in zeroAddress; 105 | bzero(&zeroAddress, sizeof(zeroAddress)); 106 | zeroAddress.sin_len = sizeof(zeroAddress); 107 | zeroAddress.sin_family = AF_INET; 108 | SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)&zeroAddress); 109 | return ref ? [self initWithReachabilityRef:ref] : nil; 110 | } 111 | 112 | - (id)initWithReachabilityRef:(SCNetworkReachabilityRef)ref 113 | { 114 | if ((self = [super init])) 115 | { 116 | self.reachabilityRef = ref; 117 | } 118 | 119 | return self; 120 | } 121 | 122 | - (void)setTarget:(id)target action:(SEL)action; 123 | { 124 | if (target) 125 | { 126 | NSParameterAssert(action != nil); 127 | } 128 | 129 | if (!self.target && target) 130 | { 131 | SCNetworkReachabilityContext context = {0, (__bridge void *)self, NULL, NULL, NULL}; 132 | if(SCNetworkReachabilitySetCallback(self.reachabilityRef, ReachabilityCallback, &context)) 133 | { 134 | SCNetworkReachabilityScheduleWithRunLoop(self.reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 135 | } 136 | } 137 | else if (self.target && !target) 138 | { 139 | SCNetworkReachabilityUnscheduleFromRunLoop(self.reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 140 | } 141 | 142 | self.target = target; 143 | self.action = action; 144 | } 145 | 146 | - (void)dealloc 147 | { 148 | [self setTarget:nil action:nil]; // triggers runloop unscheduling 149 | CFRelease(self.reachabilityRef); 150 | } 151 | 152 | - (SCNetworkReachabilityFlags)reachabilityFlags 153 | { 154 | SCNetworkReachabilityFlags flags; 155 | SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags); 156 | return flags; 157 | } 158 | 159 | - ($SDReachabilityStatus)reachabilityStatus 160 | { 161 | SCNetworkReachabilityFlags flags = self.reachabilityFlags; 162 | if (flags) 163 | { 164 | if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) 165 | { 166 | // if target host is not reachable 167 | return $SDNotReachable; 168 | } 169 | 170 | $SDReachabilityStatus status = $SDNotReachable; 171 | 172 | if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) 173 | { 174 | // if target host is reachable and no connection is required 175 | // then we'll assume (for now) that your on Wi-Fi 176 | status = $SDReachableViaWiFi; 177 | } 178 | 179 | 180 | if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || 181 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)) 182 | { 183 | // ... and the connection is on-demand (or on-traffic) if the 184 | // calling application is using the CFSocketStream or higher APIs 185 | if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) 186 | { 187 | // ... and no [user] intervention is needed 188 | status = $SDReachableViaWiFi; 189 | } 190 | } 191 | 192 | if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN) 193 | { 194 | // ... but WWAN connections are OK if the calling application 195 | // is using the CFNetwork (CFSocketStream?) APIs. 196 | status = $SDReachableViaWWAN; 197 | } 198 | 199 | return status; 200 | } 201 | else 202 | { 203 | return $SDNotReachable; 204 | } 205 | } 206 | 207 | - (BOOL)isReachable 208 | { 209 | return self.reachabilityStatus != $SDNotReachable; 210 | } 211 | 212 | - (BOOL)isReachableViaWiFi 213 | { 214 | return self.reachabilityStatus == $SDReachableViaWiFi; 215 | } 216 | 217 | - (BOOL)isReachableViaWWAN 218 | { 219 | return self.reachabilityStatus == $SDReachableViaWWAN; 220 | } 221 | 222 | - (BOOL)isConnectionRequired 223 | { 224 | SCNetworkReachabilityFlags flags = self.reachabilityFlags; 225 | return flags && (self.reachabilityFlags & kSCNetworkReachabilityFlagsConnectionRequired); 226 | } 227 | 228 | - (BOOL)isConnectionOnDemand 229 | { 230 | SCNetworkReachabilityFlags flags = self.reachabilityFlags; 231 | return flags && (flags & kSCNetworkReachabilityFlagsConnectionRequired) && (flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)); 232 | } 233 | 234 | - (BOOL)isInterventionRequired 235 | { 236 | SCNetworkReachabilityFlags flags = self.reachabilityFlags; 237 | return flags && (flags & kSCNetworkReachabilityFlagsConnectionRequired) && (flags & kSCNetworkReachabilityFlagsInterventionRequired); 238 | } 239 | 240 | @end 241 | -------------------------------------------------------------------------------- /SDReachability.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 53818C3E1649F6CB00A71BF6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53818C3D1649F6CB00A71BF6 /* Foundation.framework */; }; 11 | 53818C431649F6CB00A71BF6 /* SDReachability.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 53818C421649F6CB00A71BF6 /* SDReachability.h */; }; 12 | 53818C451649F6CB00A71BF6 /* SDReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 53818C441649F6CB00A71BF6 /* SDReachability.m */; }; 13 | 53818C52164A112B00A71BF6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53818C51164A112B00A71BF6 /* UIKit.framework */; }; 14 | 53818C53164A112B00A71BF6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53818C3D1649F6CB00A71BF6 /* Foundation.framework */; }; 15 | 53818C55164A112B00A71BF6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53818C54164A112B00A71BF6 /* CoreGraphics.framework */; }; 16 | 53818C5B164A112B00A71BF6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 53818C59164A112B00A71BF6 /* InfoPlist.strings */; }; 17 | 53818C5D164A112B00A71BF6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 53818C5C164A112B00A71BF6 /* main.m */; }; 18 | 53818C61164A112B00A71BF6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53818C60164A112B00A71BF6 /* AppDelegate.m */; }; 19 | 53818C63164A112B00A71BF6 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 53818C62164A112B00A71BF6 /* Default.png */; }; 20 | 53818C65164A112B00A71BF6 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 53818C64164A112B00A71BF6 /* Default@2x.png */; }; 21 | 53818C67164A112B00A71BF6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 53818C66164A112B00A71BF6 /* Default-568h@2x.png */; }; 22 | 53818C6A164A112B00A71BF6 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 53818C69164A112B00A71BF6 /* ViewController.m */; }; 23 | 53818C6D164A112B00A71BF6 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 53818C6B164A112B00A71BF6 /* ViewController.xib */; }; 24 | 53818C74164A119C00A71BF6 /* libSDReachability.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 53818C3A1649F6CB00A71BF6 /* libSDReachability.a */; }; 25 | 53818C76164A11A200A71BF6 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53818C75164A11A200A71BF6 /* SystemConfiguration.framework */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 53818C72164A119600A71BF6 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 53818C311649F6CB00A71BF6 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 53818C391649F6CB00A71BF6; 34 | remoteInfo = SDReachability; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXCopyFilesBuildPhase section */ 39 | 53818C381649F6CB00A71BF6 /* CopyFiles */ = { 40 | isa = PBXCopyFilesBuildPhase; 41 | buildActionMask = 2147483647; 42 | dstPath = "include/${PRODUCT_NAME}"; 43 | dstSubfolderSpec = 16; 44 | files = ( 45 | 53818C431649F6CB00A71BF6 /* SDReachability.h in CopyFiles */, 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXCopyFilesBuildPhase section */ 50 | 51 | /* Begin PBXFileReference section */ 52 | 53818C3A1649F6CB00A71BF6 /* libSDReachability.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDReachability.a; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 53818C3D1649F6CB00A71BF6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 54 | 53818C421649F6CB00A71BF6 /* SDReachability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDReachability.h; sourceTree = SOURCE_ROOT; }; 55 | 53818C441649F6CB00A71BF6 /* SDReachability.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDReachability.m; sourceTree = SOURCE_ROOT; }; 56 | 53818C4F164A112B00A71BF6 /* SDReachabilityDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SDReachabilityDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 53818C51164A112B00A71BF6 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 58 | 53818C54164A112B00A71BF6 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 59 | 53818C58164A112B00A71BF6 /* SDReachabilityDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SDReachabilityDemo-Info.plist"; sourceTree = ""; }; 60 | 53818C5A164A112B00A71BF6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 61 | 53818C5C164A112B00A71BF6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 62 | 53818C5E164A112B00A71BF6 /* SDReachabilityDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SDReachabilityDemo-Prefix.pch"; sourceTree = ""; }; 63 | 53818C5F164A112B00A71BF6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 64 | 53818C60164A112B00A71BF6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 65 | 53818C62164A112B00A71BF6 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 66 | 53818C64164A112B00A71BF6 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 67 | 53818C66164A112B00A71BF6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 68 | 53818C68164A112B00A71BF6 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 69 | 53818C69164A112B00A71BF6 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 70 | 53818C6C164A112B00A71BF6 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; 71 | 53818C75164A11A200A71BF6 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 72 | /* End PBXFileReference section */ 73 | 74 | /* Begin PBXFrameworksBuildPhase section */ 75 | 53818C371649F6CB00A71BF6 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 53818C3E1649F6CB00A71BF6 /* Foundation.framework in Frameworks */, 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | 53818C4C164A112B00A71BF6 /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | 53818C76164A11A200A71BF6 /* SystemConfiguration.framework in Frameworks */, 88 | 53818C74164A119C00A71BF6 /* libSDReachability.a in Frameworks */, 89 | 53818C52164A112B00A71BF6 /* UIKit.framework in Frameworks */, 90 | 53818C53164A112B00A71BF6 /* Foundation.framework in Frameworks */, 91 | 53818C55164A112B00A71BF6 /* CoreGraphics.framework in Frameworks */, 92 | ); 93 | runOnlyForDeploymentPostprocessing = 0; 94 | }; 95 | /* End PBXFrameworksBuildPhase section */ 96 | 97 | /* Begin PBXGroup section */ 98 | 53818C2F1649F6CB00A71BF6 = { 99 | isa = PBXGroup; 100 | children = ( 101 | 53818C3F1649F6CB00A71BF6 /* SDReachability */, 102 | 53818C56164A112B00A71BF6 /* SDReachabilityDemo */, 103 | 53818C3C1649F6CB00A71BF6 /* Frameworks */, 104 | 53818C3B1649F6CB00A71BF6 /* Products */, 105 | ); 106 | sourceTree = ""; 107 | }; 108 | 53818C3B1649F6CB00A71BF6 /* Products */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 53818C3A1649F6CB00A71BF6 /* libSDReachability.a */, 112 | 53818C4F164A112B00A71BF6 /* SDReachabilityDemo.app */, 113 | ); 114 | name = Products; 115 | sourceTree = ""; 116 | }; 117 | 53818C3C1649F6CB00A71BF6 /* Frameworks */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 53818C75164A11A200A71BF6 /* SystemConfiguration.framework */, 121 | 53818C3D1649F6CB00A71BF6 /* Foundation.framework */, 122 | 53818C51164A112B00A71BF6 /* UIKit.framework */, 123 | 53818C54164A112B00A71BF6 /* CoreGraphics.framework */, 124 | ); 125 | name = Frameworks; 126 | sourceTree = ""; 127 | }; 128 | 53818C3F1649F6CB00A71BF6 /* SDReachability */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 53818C421649F6CB00A71BF6 /* SDReachability.h */, 132 | 53818C441649F6CB00A71BF6 /* SDReachability.m */, 133 | ); 134 | path = SDReachability; 135 | sourceTree = SOURCE_ROOT; 136 | }; 137 | 53818C56164A112B00A71BF6 /* SDReachabilityDemo */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 53818C5F164A112B00A71BF6 /* AppDelegate.h */, 141 | 53818C60164A112B00A71BF6 /* AppDelegate.m */, 142 | 53818C68164A112B00A71BF6 /* ViewController.h */, 143 | 53818C69164A112B00A71BF6 /* ViewController.m */, 144 | 53818C6B164A112B00A71BF6 /* ViewController.xib */, 145 | 53818C57164A112B00A71BF6 /* Supporting Files */, 146 | ); 147 | path = SDReachabilityDemo; 148 | sourceTree = ""; 149 | }; 150 | 53818C57164A112B00A71BF6 /* Supporting Files */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 53818C58164A112B00A71BF6 /* SDReachabilityDemo-Info.plist */, 154 | 53818C59164A112B00A71BF6 /* InfoPlist.strings */, 155 | 53818C5C164A112B00A71BF6 /* main.m */, 156 | 53818C5E164A112B00A71BF6 /* SDReachabilityDemo-Prefix.pch */, 157 | 53818C62164A112B00A71BF6 /* Default.png */, 158 | 53818C64164A112B00A71BF6 /* Default@2x.png */, 159 | 53818C66164A112B00A71BF6 /* Default-568h@2x.png */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | /* End PBXGroup section */ 165 | 166 | /* Begin PBXNativeTarget section */ 167 | 53818C391649F6CB00A71BF6 /* SDReachability */ = { 168 | isa = PBXNativeTarget; 169 | buildConfigurationList = 53818C481649F6CB00A71BF6 /* Build configuration list for PBXNativeTarget "SDReachability" */; 170 | buildPhases = ( 171 | 53818C361649F6CB00A71BF6 /* Sources */, 172 | 53818C371649F6CB00A71BF6 /* Frameworks */, 173 | 53818C381649F6CB00A71BF6 /* CopyFiles */, 174 | ); 175 | buildRules = ( 176 | ); 177 | dependencies = ( 178 | ); 179 | name = SDReachability; 180 | productName = SDReachability; 181 | productReference = 53818C3A1649F6CB00A71BF6 /* libSDReachability.a */; 182 | productType = "com.apple.product-type.library.static"; 183 | }; 184 | 53818C4E164A112B00A71BF6 /* SDReachabilityDemo */ = { 185 | isa = PBXNativeTarget; 186 | buildConfigurationList = 53818C6E164A112B00A71BF6 /* Build configuration list for PBXNativeTarget "SDReachabilityDemo" */; 187 | buildPhases = ( 188 | 53818C4B164A112B00A71BF6 /* Sources */, 189 | 53818C4C164A112B00A71BF6 /* Frameworks */, 190 | 53818C4D164A112B00A71BF6 /* Resources */, 191 | ); 192 | buildRules = ( 193 | ); 194 | dependencies = ( 195 | 53818C73164A119600A71BF6 /* PBXTargetDependency */, 196 | ); 197 | name = SDReachabilityDemo; 198 | productName = SDReachabilityDemo; 199 | productReference = 53818C4F164A112B00A71BF6 /* SDReachabilityDemo.app */; 200 | productType = "com.apple.product-type.application"; 201 | }; 202 | /* End PBXNativeTarget section */ 203 | 204 | /* Begin PBXProject section */ 205 | 53818C311649F6CB00A71BF6 /* Project object */ = { 206 | isa = PBXProject; 207 | attributes = { 208 | LastUpgradeCheck = 0450; 209 | ORGANIZATIONNAME = Hackemist; 210 | }; 211 | buildConfigurationList = 53818C341649F6CB00A71BF6 /* Build configuration list for PBXProject "SDReachability" */; 212 | compatibilityVersion = "Xcode 3.2"; 213 | developmentRegion = English; 214 | hasScannedForEncodings = 0; 215 | knownRegions = ( 216 | en, 217 | ); 218 | mainGroup = 53818C2F1649F6CB00A71BF6; 219 | productRefGroup = 53818C3B1649F6CB00A71BF6 /* Products */; 220 | projectDirPath = ""; 221 | projectRoot = ""; 222 | targets = ( 223 | 53818C391649F6CB00A71BF6 /* SDReachability */, 224 | 53818C4E164A112B00A71BF6 /* SDReachabilityDemo */, 225 | ); 226 | }; 227 | /* End PBXProject section */ 228 | 229 | /* Begin PBXResourcesBuildPhase section */ 230 | 53818C4D164A112B00A71BF6 /* Resources */ = { 231 | isa = PBXResourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | 53818C5B164A112B00A71BF6 /* InfoPlist.strings in Resources */, 235 | 53818C63164A112B00A71BF6 /* Default.png in Resources */, 236 | 53818C65164A112B00A71BF6 /* Default@2x.png in Resources */, 237 | 53818C67164A112B00A71BF6 /* Default-568h@2x.png in Resources */, 238 | 53818C6D164A112B00A71BF6 /* ViewController.xib in Resources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXResourcesBuildPhase section */ 243 | 244 | /* Begin PBXSourcesBuildPhase section */ 245 | 53818C361649F6CB00A71BF6 /* Sources */ = { 246 | isa = PBXSourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | 53818C451649F6CB00A71BF6 /* SDReachability.m in Sources */, 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | 53818C4B164A112B00A71BF6 /* Sources */ = { 254 | isa = PBXSourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | 53818C5D164A112B00A71BF6 /* main.m in Sources */, 258 | 53818C61164A112B00A71BF6 /* AppDelegate.m in Sources */, 259 | 53818C6A164A112B00A71BF6 /* ViewController.m in Sources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXSourcesBuildPhase section */ 264 | 265 | /* Begin PBXTargetDependency section */ 266 | 53818C73164A119600A71BF6 /* PBXTargetDependency */ = { 267 | isa = PBXTargetDependency; 268 | target = 53818C391649F6CB00A71BF6 /* SDReachability */; 269 | targetProxy = 53818C72164A119600A71BF6 /* PBXContainerItemProxy */; 270 | }; 271 | /* End PBXTargetDependency section */ 272 | 273 | /* Begin PBXVariantGroup section */ 274 | 53818C59164A112B00A71BF6 /* InfoPlist.strings */ = { 275 | isa = PBXVariantGroup; 276 | children = ( 277 | 53818C5A164A112B00A71BF6 /* en */, 278 | ); 279 | name = InfoPlist.strings; 280 | sourceTree = ""; 281 | }; 282 | 53818C6B164A112B00A71BF6 /* ViewController.xib */ = { 283 | isa = PBXVariantGroup; 284 | children = ( 285 | 53818C6C164A112B00A71BF6 /* en */, 286 | ); 287 | name = ViewController.xib; 288 | sourceTree = ""; 289 | }; 290 | /* End PBXVariantGroup section */ 291 | 292 | /* Begin XCBuildConfiguration section */ 293 | 53818C461649F6CB00A71BF6 /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ALWAYS_SEARCH_USER_PATHS = NO; 297 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 298 | CLANG_CXX_LIBRARY = "libc++"; 299 | CLANG_ENABLE_OBJC_ARC = YES; 300 | CLANG_WARN_EMPTY_BODY = YES; 301 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 302 | COPY_PHASE_STRIP = NO; 303 | GCC_C_LANGUAGE_STANDARD = gnu99; 304 | GCC_DYNAMIC_NO_PIC = NO; 305 | GCC_OPTIMIZATION_LEVEL = 0; 306 | GCC_PREPROCESSOR_DEFINITIONS = ( 307 | "DEBUG=1", 308 | "$(inherited)", 309 | ); 310 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 312 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 313 | GCC_WARN_UNUSED_VARIABLE = YES; 314 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 315 | ONLY_ACTIVE_ARCH = YES; 316 | SDKROOT = iphoneos; 317 | }; 318 | name = Debug; 319 | }; 320 | 53818C471649F6CB00A71BF6 /* Release */ = { 321 | isa = XCBuildConfiguration; 322 | buildSettings = { 323 | ALWAYS_SEARCH_USER_PATHS = NO; 324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 325 | CLANG_CXX_LIBRARY = "libc++"; 326 | CLANG_ENABLE_OBJC_ARC = YES; 327 | CLANG_WARN_EMPTY_BODY = YES; 328 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 329 | COPY_PHASE_STRIP = YES; 330 | GCC_C_LANGUAGE_STANDARD = gnu99; 331 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 332 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 333 | GCC_WARN_UNUSED_VARIABLE = YES; 334 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 335 | SDKROOT = iphoneos; 336 | VALIDATE_PRODUCT = YES; 337 | }; 338 | name = Release; 339 | }; 340 | 53818C491649F6CB00A71BF6 /* Debug */ = { 341 | isa = XCBuildConfiguration; 342 | buildSettings = { 343 | DSTROOT = /tmp/SDReachability.dst; 344 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 345 | GCC_PREFIX_HEADER = ""; 346 | OTHER_LDFLAGS = "-ObjC"; 347 | PRODUCT_NAME = "$(TARGET_NAME)"; 348 | SKIP_INSTALL = YES; 349 | }; 350 | name = Debug; 351 | }; 352 | 53818C4A1649F6CB00A71BF6 /* Release */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | DSTROOT = /tmp/SDReachability.dst; 356 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 357 | GCC_PREFIX_HEADER = ""; 358 | OTHER_LDFLAGS = "-ObjC"; 359 | PRODUCT_NAME = "$(TARGET_NAME)"; 360 | SKIP_INSTALL = YES; 361 | }; 362 | name = Release; 363 | }; 364 | 53818C6F164A112B00A71BF6 /* Debug */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 368 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 369 | GCC_PREFIX_HEADER = "SDReachabilityDemo/SDReachabilityDemo-Prefix.pch"; 370 | INFOPLIST_FILE = "SDReachabilityDemo/SDReachabilityDemo-Info.plist"; 371 | PRODUCT_NAME = "$(TARGET_NAME)"; 372 | WRAPPER_EXTENSION = app; 373 | }; 374 | name = Debug; 375 | }; 376 | 53818C70164A112B00A71BF6 /* Release */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 380 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 381 | GCC_PREFIX_HEADER = "SDReachabilityDemo/SDReachabilityDemo-Prefix.pch"; 382 | INFOPLIST_FILE = "SDReachabilityDemo/SDReachabilityDemo-Info.plist"; 383 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | WRAPPER_EXTENSION = app; 386 | }; 387 | name = Release; 388 | }; 389 | /* End XCBuildConfiguration section */ 390 | 391 | /* Begin XCConfigurationList section */ 392 | 53818C341649F6CB00A71BF6 /* Build configuration list for PBXProject "SDReachability" */ = { 393 | isa = XCConfigurationList; 394 | buildConfigurations = ( 395 | 53818C461649F6CB00A71BF6 /* Debug */, 396 | 53818C471649F6CB00A71BF6 /* Release */, 397 | ); 398 | defaultConfigurationIsVisible = 0; 399 | defaultConfigurationName = Release; 400 | }; 401 | 53818C481649F6CB00A71BF6 /* Build configuration list for PBXNativeTarget "SDReachability" */ = { 402 | isa = XCConfigurationList; 403 | buildConfigurations = ( 404 | 53818C491649F6CB00A71BF6 /* Debug */, 405 | 53818C4A1649F6CB00A71BF6 /* Release */, 406 | ); 407 | defaultConfigurationIsVisible = 0; 408 | defaultConfigurationName = Release; 409 | }; 410 | 53818C6E164A112B00A71BF6 /* Build configuration list for PBXNativeTarget "SDReachabilityDemo" */ = { 411 | isa = XCConfigurationList; 412 | buildConfigurations = ( 413 | 53818C6F164A112B00A71BF6 /* Debug */, 414 | 53818C70164A112B00A71BF6 /* Release */, 415 | ); 416 | defaultConfigurationIsVisible = 0; 417 | defaultConfigurationName = Release; 418 | }; 419 | /* End XCConfigurationList section */ 420 | }; 421 | rootObject = 53818C311649F6CB00A71BF6 /* Project object */; 422 | } 423 | -------------------------------------------------------------------------------- /SDReachabilityDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SDReachabilityDemo 4 | // 5 | // Created by Olivier Poitrey on 07/11/12. 6 | // Copyright (c) 2012 Hackemist. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) ViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SDReachabilityDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SDReachabilityDemo 4 | // 5 | // Created by Olivier Poitrey on 07/11/12. 6 | // Copyright (c) 2012 Hackemist. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 18 | // Override point for customization after application launch. 19 | self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; 20 | self.window.rootViewController = self.viewController; 21 | [self.window makeKeyAndVisible]; 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application 26 | { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | - (void)applicationDidEnterBackground:(UIApplication *)application 32 | { 33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application 38 | { 39 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application 43 | { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application 48 | { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /SDReachabilityDemo/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rs/SDReachability/58800f5896211233c5c70ba3b32cb4ec7f6bc0af/SDReachabilityDemo/Default-568h@2x.png -------------------------------------------------------------------------------- /SDReachabilityDemo/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rs/SDReachability/58800f5896211233c5c70ba3b32cb4ec7f6bc0af/SDReachabilityDemo/Default.png -------------------------------------------------------------------------------- /SDReachabilityDemo/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rs/SDReachability/58800f5896211233c5c70ba3b32cb4ec7f6bc0af/SDReachabilityDemo/Default@2x.png -------------------------------------------------------------------------------- /SDReachabilityDemo/SDReachabilityDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.hackemist.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SDReachabilityDemo/SDReachabilityDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SDReachabilityDemo' target in the 'SDReachabilityDemo' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /SDReachabilityDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SDReachabilityDemo 4 | // 5 | // Created by Olivier Poitrey on 07/11/12. 6 | // Copyright (c) 2012 Hackemist. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @property (weak, nonatomic) IBOutlet UILabel *reachableLabel; 14 | @property (weak, nonatomic) IBOutlet UILabel *WWANLabel; 15 | @property (weak, nonatomic) IBOutlet UILabel *WiFiLabel; 16 | 17 | - (IBAction)dealloc:(id)sender; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SDReachabilityDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SDReachabilityDemo 4 | // 5 | // Created by Olivier Poitrey on 07/11/12. 6 | // Copyright (c) 2012 Hackemist. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SDReachability.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (strong, nonatomic) SDReachability *reachability; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad 21 | { 22 | [super viewDidLoad]; 23 | self.reachability = [SDReachability reachabilityWithTarget:self action:@selector(reachabilityChanged:)]; 24 | [self displayReachabilityInfo:self.reachability]; 25 | } 26 | 27 | - (void)displayReachabilityInfo:(SDReachability *)reachability 28 | { 29 | self.reachableLabel.text = self.reachability.reachable ? @"YES" : @"NO"; 30 | self.WWANLabel.text = self.reachability.isReachableViaWWAN ? @"YES" : @"NO"; 31 | self.WiFiLabel.text = self.reachability.isReachableViaWiFi ? @"YES" : @"NO"; 32 | } 33 | 34 | - (void)reachabilityChanged:(SDReachability *)reachability 35 | { 36 | [self displayReachabilityInfo:reachability]; 37 | } 38 | 39 | - (IBAction)dealloc:(id)sender 40 | { 41 | self.reachability = nil; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /SDReachabilityDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /SDReachabilityDemo/en.lproj/ViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUIButton 16 | IBUILabel 17 | IBUIView 18 | 19 | 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | 28 | IBFilesOwner 29 | IBCocoaTouchFramework 30 | 31 | 32 | IBFirstResponder 33 | IBCocoaTouchFramework 34 | 35 | 36 | 37 | 274 38 | 39 | 40 | 41 | 293 42 | 43 | 44 | 45 | 292 46 | {{121, 140}, {78, 44}} 47 | 48 | 49 | _NS:9 50 | NO 51 | IBCocoaTouchFramework 52 | 0 53 | 0 54 | 1 55 | Dealloc 56 | 57 | 3 58 | MQA 59 | 60 | 61 | 1 62 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 63 | 64 | 65 | 3 66 | MC41AA 67 | 68 | 69 | 2 70 | 15 71 | 72 | 73 | Helvetica-Bold 74 | 15 75 | 16 76 | 77 | 78 | 79 | 80 | 292 81 | {{20, 20}, {128, 21}} 82 | 83 | 84 | 85 | _NS:9 86 | NO 87 | YES 88 | 7 89 | NO 90 | IBCocoaTouchFramework 91 | Reachable: 92 | 93 | 1 94 | MCAwIDAAA 95 | darkTextColor 96 | 97 | 98 | 0 99 | 2 100 | 101 | 2 102 | 17 103 | 104 | 105 | Helvetica-Bold 106 | 17 107 | 16 108 | 109 | NO 110 | 111 | 112 | 113 | 292 114 | {{20, 49}, {128, 21}} 115 | 116 | 117 | 118 | _NS:9 119 | NO 120 | YES 121 | 7 122 | NO 123 | IBCocoaTouchFramework 124 | WWAN: 125 | 126 | 127 | 0 128 | 2 129 | 130 | 131 | NO 132 | 133 | 134 | 135 | 292 136 | {{20, 78}, {128, 21}} 137 | 138 | 139 | 140 | _NS:9 141 | NO 142 | YES 143 | 7 144 | NO 145 | IBCocoaTouchFramework 146 | WiFi: 147 | 148 | 149 | 0 150 | 2 151 | 152 | 153 | NO 154 | 155 | 156 | 157 | 292 158 | {{156, 78}, {128, 21}} 159 | 160 | 161 | 162 | _NS:9 163 | NO 164 | YES 165 | 7 166 | NO 167 | IBCocoaTouchFramework 168 | - 169 | 170 | 171 | 0 172 | 173 | 1 174 | 17 175 | 176 | 177 | Helvetica 178 | 17 179 | 16 180 | 181 | NO 182 | 183 | 184 | 185 | 292 186 | {{156, 20}, {128, 21}} 187 | 188 | 189 | 190 | _NS:9 191 | NO 192 | YES 193 | 7 194 | NO 195 | IBCocoaTouchFramework 196 | - 197 | 198 | 199 | 0 200 | 201 | 202 | NO 203 | 204 | 205 | 206 | 292 207 | {{156, 49}, {128, 21}} 208 | 209 | 210 | 211 | _NS:9 212 | NO 213 | YES 214 | 7 215 | NO 216 | IBCocoaTouchFramework 217 | - 218 | 219 | 220 | 0 221 | 222 | 223 | NO 224 | 225 | 226 | {{0, 40}, {320, 203}} 227 | 228 | 229 | _NS:10 230 | 231 | 3 232 | MQA 233 | 234 | 2 235 | 236 | 237 | IBCocoaTouchFramework 238 | 239 | 240 | {{0, 20}, {320, 548}} 241 | 242 | 243 | 244 | 245 | NO 246 | 247 | 248 | IBUIScreenMetrics 249 | 250 | YES 251 | 252 | 253 | 254 | 255 | 256 | {320, 568} 257 | {568, 320} 258 | 259 | 260 | IBCocoaTouchFramework 261 | Retina 4 Full Screen 262 | 2 263 | 264 | IBCocoaTouchFramework 265 | 266 | 267 | 268 | 269 | 270 | 271 | view 272 | 273 | 274 | 275 | 7 276 | 277 | 278 | 279 | WiFiLabel 280 | 281 | 282 | 283 | 18 284 | 285 | 286 | 287 | reachableLabel 288 | 289 | 290 | 291 | 16 292 | 293 | 294 | 295 | WWANLabel 296 | 297 | 298 | 299 | 17 300 | 301 | 302 | 303 | dealloc: 304 | 305 | 306 | 7 307 | 308 | 20 309 | 310 | 311 | 312 | 313 | 314 | 0 315 | 316 | 317 | 318 | 319 | 320 | -1 321 | 322 | 323 | File's Owner 324 | 325 | 326 | -2 327 | 328 | 329 | 330 | 331 | 6 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 21 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 19 354 | 355 | 356 | 357 | 358 | 8 359 | 360 | 361 | 362 | 363 | 11 364 | 365 | 366 | 367 | 368 | 12 369 | 370 | 371 | 372 | 373 | 15 374 | 375 | 376 | 377 | 378 | 13 379 | 380 | 381 | 382 | 383 | 14 384 | 385 | 386 | 387 | 388 | 389 | 390 | ViewController 391 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 392 | UIResponder 393 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 394 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 395 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 396 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 397 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 398 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 399 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 400 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 401 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 402 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 403 | 404 | 405 | 406 | 407 | 408 | 21 409 | 410 | 411 | 412 | 413 | ViewController 414 | UIViewController 415 | 416 | dealloc: 417 | id 418 | 419 | 420 | dealloc: 421 | 422 | dealloc: 423 | id 424 | 425 | 426 | 427 | UILabel 428 | UILabel 429 | UILabel 430 | 431 | 432 | 433 | WWANLabel 434 | UILabel 435 | 436 | 437 | WiFiLabel 438 | UILabel 439 | 440 | 441 | reachableLabel 442 | UILabel 443 | 444 | 445 | 446 | IBProjectSource 447 | ./Classes/ViewController.h 448 | 449 | 450 | 451 | 452 | 0 453 | IBCocoaTouchFramework 454 | 455 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 456 | 457 | 458 | YES 459 | 3 460 | 1930 461 | 462 | 463 | -------------------------------------------------------------------------------- /SDReachabilityDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SDReachabilityDemo 4 | // 5 | // Created by Olivier Poitrey on 07/11/12. 6 | // Copyright (c) 2012 Hackemist. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | --------------------------------------------------------------------------------