reachability

how to block user , if he/she not connected to internet connection when my app load

匆匆过客 提交于 2019-12-08 07:44:16
问题 I have one app, which is fully map view.What I need is I need to show some alert if user not connected to internet . I have done that. Here is the code : Reachability.swift. import Foundation import SystemConfiguration public class Reachability { class func isConnectedToNetwork() -> Bool { var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0)) zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress)) zeroAddress.sin

iPhone app, alert users when they aren't connected to the internet?

自古美人都是妖i 提交于 2019-12-08 04:57:18
问题 What's an easy way to code an alert that warns users when they aren't connected to the Internet? I'm using Xcode, right now when there is no connection it is just a white screen in uiwebview. 回答1: Here you can check if wifi has connection, 3g,or none atall: if ([[Reachability reachabilityWithHostName:@"google.com"] currentReachabilityStatus] == ReachableViaWiFi) { // Do something that requires wifi } else if ([[Reachability reachabilityWithHostName:@"google.com"] currentReachabilityStatus] ==

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

空扰寡人 提交于 2019-12-08 03:06:27
问题 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:

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

↘锁芯ラ 提交于 2019-12-07 23:57:57
问题 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

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

99封情书 提交于 2019-12-07 15:54:00
问题 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

Does SCNetworkReachability respect HTTP proxy settings?

眉间皱痕 提交于 2019-12-07 08:10:26
问题 I'm afraid the answer to this is No, but I'm hoping someone can provide a definitive answer as it is not documented in the current iOS SDK documentation. We're seeing a case where NSURLConnection is able to connect to https://mysite.com via an HTTP proxy but, because of the way the local DNS is setup in this case, DNS lookups for mysite.com will fail. In this case, it appears that SCNetworkReachability is trying to perform a DNS lookup for mysite.com and failing. Meanwhile, NSURLConnection is

Send data to server whenever internet connection is available iOS

北战南征 提交于 2019-12-07 07:14:48
问题 I am developing an iOS app, What i want to do is, whenever user turned on/off his internet from setting app, i want to set some notification to device. In short, i want to send some data (stored in NSUserDefaults) to server whenever internet connection is available(assuming internet connection appears after 2 3 days)....possible? Please help and thanks in advance. 回答1: Try this Apple example: https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html If you want

App crashing when using Reachability Classes to check for internet connection

戏子无情 提交于 2019-12-07 05:11:20
问题 I'm using this code to check for an internet connection but I'm getting a crash saying +[Reachability reachabilityForInternetConnection]: unrecognized selector sent to class 0xcbe0c8 I've imported Reachability .h/.m and the systemconfig framework. Crash is at line self.internetRechable = [[Reachability reachabilityForInternetConnection] retain]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetworkStatus:) name:kReachabilityChangedNotification object:nil];

iOS: reachabilityWithHostname YES although it should be NO

 ̄綄美尐妖づ 提交于 2019-12-07 03:38:35
问题 I tested different frameworks, e.g. https://github.com/tonymillion/Reachability https://github.com/VerticodeLabs/VCLReachability https://github.com/kstenerud/KSReachability and I would like to know if a host is reachable. On my iPhone, I set my iMac as proxy (Charles) and block or don't block the connections, but the reachability is always YES. Only if I set a non-existing host, it returns NO. But if the host exists but I block the connection to it, I always get isReachable . Isn't there a

How does the iOS Reachability class work, and why the IP Address 169.254.0.0?

巧了我就是萌 提交于 2019-12-06 12:32:06
How does the iOS Reachability class work, and what's so special about the IP Address 169.254.0.0? I'm trying to figure out whether Wi-Fi is on, independent of whether it is connected to an actual Wi-Fi network or not. I haven't found a satisfactory answer for this question on SO, and even the answers that try to answer this don't work for me. When you fail to get an IP address from DHCP, it will automatically assign you a random address in the 169.254.x.x range. So if you have an IP address like this, it means you're connected to a network, and set to use DHCP to get an address, but it is