reachability

How to test EDGE or GPRS or any other slow/bad network

拜拜、爱过 提交于 2019-12-06 09:47:38
In my iOS app, I support to work online as well as offline. For this I have used Apple's Reachability code . Now I want to show user is offline if the cellular mobile network is EDGE or GPRS or bad/slow network. I have used the below code( Found solution ). Code: CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new]; NSLog(@"Current Radio Access Technology: %@", telephonyInfo.currentRadioAccessTechnology); [NSNotificationCenter.defaultCenter addObserverForName:CTRadioAccessTechnologyDidChangeNotification object:nil queue:nil usingBlock:^(NSNotification *note) { NSLog(@"New Radio

iPhone Reachable classes

北慕城南 提交于 2019-12-06 08:28:07
I have added the two files Reachability.h/m. The problem I am having is in the ReachabilityCallback method NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback"); The error message is: Cast of C pointer type 'void *' to Objective-C pointer type 'NSObject * requires a bridged cast NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init]; Error: 'NSAutoreleasePool' is unavailable: not available in automatic reference counting mode SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL}; Error: Implicit conversion of an

Is Apple's current Reachability class backwards-compatible with iOS 3.1?

馋奶兔 提交于 2019-12-06 07:45:51
I'm implementing Apple's Reachibility class into my application. The app's base SDK is iOS 4.0, and its deployment target is iOS 3.1. I do not have a 3.1 device to test with, so can anyone tell me if it is backwards compatible? The documents for Reachability say that iOS 4.0 is required, so if it does indeed need a minimum of 4.0, how can I make it work on 3.1? All I'm doing is testing to see if they are connected to a WiFi network. I'm having to limit streaming video to WiFi only because of Apple's new restrictions (not looking to implement their HTTP Live Streaming at this time). Here is the

popup alert when Reachability connection is lost during using the app (IOS xcode swift)

风流意气都作罢 提交于 2019-12-06 06:19:32
I am a beginner of IOS app development and would like to "popup alert when Reachability connection is lost during using the app (IOS xcode swift)", but I only get popup alert when starting the my app. There is not alert popup during using my app when internet connection lost. Please kindly help, thanks! What I did: 1) creat a Reachability.swift file and worte import Foundation public class Reachability { class func isConnectedToNetwork()->Bool{ var Status:Bool = false let url = NSURL(string: "http://google.com/") let request = NSMutableURLRequest(URL: url!) request.HTTPMethod = "HEAD" request

iOS Unexpected platform condition (expected 'os', 'arch', or 'swift') - Reachability

吃可爱长大的小学妹 提交于 2019-12-06 06:14:50
I just update my pods. after update Reachability causing an error Unexpected platform condition (expected 'os', 'arch', or 'swift') I tried to build and clean but it does not work. what's the solution? Please help me to fix this. Thanks in advance. Muhammad Umair Gillani use this 1 #if (arch(i386) || arch(x86_64)) && os(iOS) #endif You can try as Muhammad says. I suggest the following code which is very easy to maintain. Copy paste the following code to a file and try yourself. import Foundation import SystemConfiguration class Network { // Declarations static let shared = Network() // Check

Reachability on iPhone app with a false positive - will it get past apple?

99封情书 提交于 2019-12-06 05:30:36
I am using this code... Reachability *r = [Reachability reachabilityWithHostName:@"www.maxqdata.com"]; NetworkStatus internetStatus = [r currentReachabilityStatus]; if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) { UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"You require an internet connection via WiFi or cellular network for location finding to work." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [myAlert show]; [myAlert release]; } from this thread http://www.iphonedevsdk.com/forum/iphone-sdk

How to check for network reachability on iOS in a non-blocking manner?

不问归期 提交于 2019-12-06 02:46:41
In my iOS project, I would like to display a message to the user to connect to the internet before certain network operations, so I wrote the following check using Apple's Reachability class: Reachability *reach = [Reachability reachabilityWithHostName:@"google.com"]; if([reach currentReachabilityStatus] == NotReachable) { // ...prompt user to establish an internet connection } else { // ...send an asynchronous request with a timeout } However, this had one very big problem--when the device was on a very lossy network (for example, when uplink packet loss is set to 100% on OS X Lion's Network

Reachability vs UIDevice-Reachability

落花浮王杯 提交于 2019-12-06 01:41:45
I need to test network reachability in my iPhone project. Which project is better to use? Reachability vs UIDevice-Reachability Radu Reachability if your only issue is to test network reachability. It's apple sample code and it's pretty easy to use. UIDevice is great for learning but a bit overkill just for network reachability. So in the end either of them will do. Depends on what you want to do. 来源: https://stackoverflow.com/questions/4954904/reachability-vs-uidevice-reachability

Cannot invoke initializer for type 'UnsafeMutablePointer'

爷,独闯天下 提交于 2019-12-05 21:07:30
I'm trying to update Reachability.swift to swift 3.0 and I'm having trouble passing the Reachability instance to the call back function. Here is my snippet: * please note self = Reachability class var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil) context.info = UnsafeMutablePointer(Unmanaged.passUnretained(self).toOpaque()) Where the compiler throws an error saying: Cannot invoke initializer for type 'UnsafeMutablePointer<_>' with an argument list of type '(UnsafeMutableRawPointer)' Pointer conversion restricted: use '

Detecting internet connectivity continually

﹥>﹥吖頭↗ 提交于 2019-12-05 18:24:29
I want my app to detect the internet connection loss automatically. So im using the following code. - (void)applicationDidBecomeActive:(UIApplication *)application { Reachability *networkReachability = [Reachability reachabilityForInternetConnection]; NetworkStatus networkStatus = [networkReachability currentReachabilityStatus]; if (networkStatus == NotReachable) { [Settings hideSpinner]; //Show no internet connectivity dialog. } else { } } But the problem is that it is not checking the internet connectivity continually. it checks only when the app has become active. How can I be able to check