reachability

My Reachability Notifier is only able to be called once

眉间皱痕 提交于 2019-12-01 12:44:26
So, I have the following in my AppDelegate. It will notify my when I turn my WIFI off but will not react after that initial run. I have had this working in the past. I'm on swift 3 with Xcode 8 and the reachability that is for this version of the swift and xCode. I'm hoping to get a solution to this. Thanks. var reachability: Reachability? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. self.reachability = Reachability() NotificationCenter

Check if iPhone is connected to the internet [duplicate]

烈酒焚心 提交于 2019-12-01 11:14:48
This question already has an answer here: How to check for an active Internet connection on iOS or macOS? 42 answers how I can check quickly if the iPhone is connected to internet or not, quickly... Thanks... Have a look at Apple's Reachability class and this example app . You should try to connect to the server with what you think is an appropriate timeout. NEVER use the reachability API until you've determined that your connection attempt failed and even then only if the error you receive from NSURLConnection et. al. is one that suggests you're not connected to the network. In that case, use

SCNetworkReachabilityGetFlags in Reachability sample code takes too long to return

限于喜欢 提交于 2019-12-01 10:32:36
I'm using iOS4.1 on an iPhone4. I'm also using the latest version of the Reachability code. My device doesn't have a connection but it seems like the code waits to timeout or else the device takes ages to report back about the reachability status. this doesn't seem to happen on iOS4.0.1 using iPhone3gs. Has anyone else come across this? Any way to get around it other than starting a new thread? Are you sure you're using it asynchronously? From Apple's docs ReadMe.txt on the Reachability project: The Reachability sample demonstrates the asynchronous use of the SCNetworkReachability API. You can

Reachability working on simulator but not on device

允我心安 提交于 2019-12-01 10:13:09
问题 In my project I am using Reachability class provided by Apple. When there is no internet connection, I am displaying an alert message. Everything is working fine, when I test it on the simulator, but when am running it on iPad, the alert message is not shown when there is no internet. I am running the code on iOS 5.0. Any help would be appreciated. EDIT: -(BOOL)isInternetConnectionPresent{ Reachability *objReachability = [Reachability reachabilityForInternetConnection]; NetworkStatus

iOS Reachability fails to catch the case where connected to WiFi but not logged in

霸气de小男生 提交于 2019-12-01 09:25:33
Today, I had my Beta-version app out in public. I was at a hotel and had not yet obtained the access code for the WiFi. When testing the reachability, I noticed that it didn't fail as it should have. It was connected to WiFi but nothing was actually reachable because I wasn't logged in. This use-case should be covered by reachabilityWithHostname . Here's my code: In AppDelegate.h: @interface AppDelegate : UIResponder <UIApplicationDelegate> { Reachability* hostReach; Reachability* internetReach; Reachability* wifiReach; } In AppDelegate.m: internetReach = [Reachability

SCNetworkReachabilityGetFlags in Reachability sample code takes too long to return

霸气de小男生 提交于 2019-12-01 08:38:54
问题 I'm using iOS4.1 on an iPhone4. I'm also using the latest version of the Reachability code. My device doesn't have a connection but it seems like the code waits to timeout or else the device takes ages to report back about the reachability status. this doesn't seem to happen on iOS4.0.1 using iPhone3gs. Has anyone else come across this? Any way to get around it other than starting a new thread? 回答1: Are you sure you're using it asynchronously? From Apple's docs ReadMe.txt on the Reachability

iOS Reachability test

泄露秘密 提交于 2019-12-01 08:35:50
For our app, we use the following code to check for internet connection whenever the app user is trying to post a message. When we test the feature, it works fine when turning on the airplane mode. Then when we turn off the airplane mode, the call to connected still returns NO. What could be the reason for that? Do we need extra "setup" in the order in order to get it right? such as listen to network state change notifications? + (BOOL)connected { Reachability *hostReach = [Reachability reachabilityForInternetConnection]; NetworkStatus netStatus = [hostReach currentReachabilityStatus]; return

iOS Reachability fails to catch the case where connected to WiFi but not logged in

巧了我就是萌 提交于 2019-12-01 06:29:36
问题 Today, I had my Beta-version app out in public. I was at a hotel and had not yet obtained the access code for the WiFi. When testing the reachability, I noticed that it didn't fail as it should have. It was connected to WiFi but nothing was actually reachable because I wasn't logged in. This use-case should be covered by reachabilityWithHostname . Here's my code: In AppDelegate.h: @interface AppDelegate : UIResponder <UIApplicationDelegate> { Reachability* hostReach; Reachability*

Swift: How to check if my app has WLAN permission and the device is connected to a WIFI source?

微笑、不失礼 提交于 2019-12-01 04:41:19
问题 I'm developing an app in which I need to know: Does my app has the permission to access WLAN network. Is the device currently connected to a WIFI. I know you can use Reachability to check if the device is connected to the internet, but it return true even if the app doesn't has the permission to access network. How can I know the 2 information I listed above ? Additional information: This is not a regular app. This app is used to control a toy via WIFI. So I don't really care if the app is

Notification when Internet became available on iOS

爷,独闯天下 提交于 2019-12-01 03:49:59
问题 Is it possible to receive a notification or something inside my app when the internet BECOMES available. I'm aware of reachability and all kinds of stuff. But what i want is to start some pending NSUrlConnections when internet becomes available on the device. Is there a easy way to do this, because I don't want to use a looping thread that checks constantly for reachability. Any suggestions? 回答1: Ok, here is very nice post about Reachability: http://www.mikeash.com/pyblog/friday-qa-2013-06-14