reachability

Using ASIHTTPRequest's Reachability

时光怂恿深爱的人放手 提交于 2019-12-11 20:08:45
问题 I'm begin to use Reachability in my iOS project to test if there's internet connection or not. My app consists in a UITabBarController with 3 different tabs. Each tab's root is a different UIViewController . In each controller I make several requests relying on user's actions. My question is how to create a global function (or a macro) to use before each function that uses internet connection without rewriting this function in every controller. Is possible to have a function that does this? I

Incorrect Response - Reachability For WWAN

旧巷老猫 提交于 2019-12-11 14:46:31
问题 While checking for reachability(network availability) of an iPAD 3 WiFi+Cellular, I ran into across a weird issue that happened in the below mentioned scenario. To check network availability I have used Apple sample code for reachability. The following code was implemented to check availability of WiFi or WWAN. ` - (BOOL)networkCheck { Reachability *wifiReach = [Reachability reachabilityForInternetConnection]; NetworkStatus netStatus = [wifiReach currentReachabilityStatus]; switch (netStatus)

IOS dispatch_get_main_queue() is called multiple times

本小妞迷上赌 提交于 2019-12-11 14:23:20
问题 I test internet connection with Reachability and dispatch_async(dispatch_get_main_queue() when I test the following code it works but it is called multiple times. Parent: @protocol RootViewDelegate <NSObject> @optional -(void)internetIsDownGoToRoot; @end - (void)testInternetConnection { internetReachableFoo = [ReachabilityTony reachabilityWithHostname:@"www.google.com"]; __weak typeof(self) weakSelf = self; // Internet is reachable internetReachableFoo.reachableBlock = ^(ReachabilityTony

iOS voip app sleeps & Reachability has changed, can I get notification?

≡放荡痞女 提交于 2019-12-11 13:35:00
问题 I'm building a voip app for iOS and I'm handling working at background. So far, i have iOS listening to the voip socket while app sleeps and wake it uppon incoming data. My question is: When the reachability has changed (Wifi -> 3G, Wifi -> Other Wifi, etc) and the app is suspended, can I get some notification in order to reconnect my voip socket? Thanks. 回答1: Answer was both Yes and No: Register to Reachability network changes notifications. If App goes to background suspended while its voip

How to interpret NetworkReachabilityFlags in Xamarin.iOS?

只愿长相守 提交于 2019-12-11 07:10:08
问题 I'm using NetworkReachability to figure out the connectivity status of my app: NetworkReachability(this.currentHostUrl); remoteHostReachability.SetNotification(this.ReachabilityChanged); remoteHostReachability.Schedule(CFRunLoop.Current, CFRunLoop.ModeDefault); The callback method looks like this: void ReachabilityChanged(NetworkReachabilityFlags flags) { this.reachable = (flags & NetworkReachabilityFlags.Reachable) > 0; UIHelpers.GetAppDelegate().UpdateConnectivityToast(this.reachable); }

Getting Reachability changed notifications in the background

拥有回忆 提交于 2019-12-11 07:01:26
问题 Im developing an app that uploads media to a server. I use Andrew Donoho's Reachability class to determine if I've got Reachability via WiFi, WWAN or if it is not reachable. (Users can choose if they upload media only over WiFi or WiFi and WWAN). If the application enters the background, uploads should continue. But if the user loses WiFi connectivity while the app is in the background, uploads should stop. This is why I need to find a way to get Reachability changed notifications in the

Reachability with IP address won't work.

余生长醉 提交于 2019-12-11 04:36:11
问题 After inputting the Rechability classes Apple provided. Also after inputting this, Reachability reachabilityWithAddress:(const struct sockaddr_in *)hostAddress. How should we input the IP address we want to check into this line? This is the part where i'm really lost at. 回答1: struct sockaddr_in is a low-level "socket address" type used by BSD sockets. We generally don't deal with them at the Cocoa level, but they can creep up from time to time, including in Apple's demo class. The reason

How to use Reachability class to detect network status?

隐身守侯 提交于 2019-12-11 02:28:03
问题 I am creating an app which requires internet. I want to use reachability class in my project and I want to detect if user has no internet connection whatever the technique is either wifi, Cellular. I want a step by step guide for this. 回答1: You can start with Reachability sample application. There is also some entries on SO that are about the subject. 来源: https://stackoverflow.com/questions/2033042/how-to-use-reachability-class-to-detect-network-status

Detect Internet Connection and display UIAlertview Swift 3

筅森魡賤 提交于 2019-12-11 01:23:44
问题 I am making an app that detects if there is a connection to internet by using if else statement, when there is internet, do nothing but if there are no internet connection, then alert view to say the app requires an internet I managed found Reachability but to implement on my viewDidLoad() the uialertview seems to be not working. I am using this: public class Reachability { class func isConnectedToNetwork() -> Bool { var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin

Reachability - strange issue

ぐ巨炮叔叔 提交于 2019-12-10 17:12:29
问题 Reachability *r = [Reachability reachabilityWithHostName:@"www.google.com"]; This line works fine on device, but on simulator i get crash : * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[Reachability reachabilityWithHostName:]: unrecognized selector sent to class Does anyone know why ? 回答1: I had almost the same problem, except that linker did not link Reachability after I added it via pod. internetReachable = [Reachability reachabilityWithHostName:@"www