Reachability code not working accurately in ios - ios

In my application i want to check server accessibility before going to the next screen when a button is tapped.
I have used tony million reachability and AFNetworking reachability, they are all working fine. But the issue is when i turned off my wifi, it is taking 10 secs time to reflect the same in iPad, meantime if i check the server connectivity it is showing that server is reachable (i am using iPadAir and it is not connected to Mobile Data). After iPad is detecting that wifi is switched off only it is giving not reachable. i even tried with apple simple ping example, still i am getting the same issue.
Please advice

Run reachability function viewdidload and save value. Use this value buttonPress event and in buttonPress event Run reachability function on background again.

Finally i found a solution
Please go through this website
SimplePingHelper is written on top of SimplePing and is very easy to use
Thanks

Related

Check internet connection when user interacts

Where I should implement a function to check internet connection on user's iPhone every time?
Exactly:
when some ViewController appears
when user goes to home screen and returns to app via multitasking
I have a lot of .swift files and I don't want to implement code in every viewWillApear function of every .swift file. Maybe there is some native place somewhere in AppDelegate or else?
Where I should implement a function to check internet connection on user's iPhone every time?
You shouldn't. The way to ask if the network is working is simply to try to use the network. You just attempt to do your networking and either you succeed or you fail in good order, and you take it from there. Most networking is done with URLSession, which will handle this gracefully for you, and in iOS 11 can even be configured to try again later automatically (waitsForConnectivity). Please watch the relevant WWDC 2017 video for further discussion.

Replace outgoing call screen in objective C iOS

I am trying to override the default outgoing call screen with my own custom screen in objective C. I have tried it for last 2 days, but in all forum i was seeing negative answer like it was not possible in Objective C.
But i saw a app called Rebtel which achieved the same functionality of replacing the default outgoing call screen(in Local minutes mode). Could anyone here give an idea of how we do that?
I have also attached rebtel screenshot for your reference.
It's not possible to replace the outgoing call screen, this could potentially create a privacy issues.
Also the app you mention is 100% voip app, I've installed the app turn off my WiFi and cellular data. And the app stop working:
If you have a internet connection an the choose not to user VOIP then the normal dialer is presented:

Tony Millions Reachability class incorrectly reports unreachable from iOS simulator

I am having consistent issues with the Reachability class reporting incorrect state and losing notifications from Tony Millions reachability class. Although something similar has been reported here I would like to add more information that may or may not be useful in resolving my variation of the problem.
Firstly, I'm using the latest Xcode Version 6.3.2 (6D2105) and am working on a Macbook Pro connected via Wifi and have downloaded the latest Reachability class (as of today by post date 5 Aug 2015) which I have set up as an instance that I pass around my iPhone application (not a singleton pattern).
Secondly, and probably quite importantly I'm using the iOS simulator in order to get the application behaviour correct before deploying it to an iPhone.
I'm taking advantage of both the notification mechanism, and also the direct 'isReachable' method depending on my usage about the code - notifications for triggering sync'ing and status bar updates and the 'isReachable' for conditional method calls. The reachability class is instantiated in the app delegate using this style:
[Reachability reachabilityWithHostname:hostAddress]
And the reachability notification service is started using the
[reachability startNotifier]
method. Now, when the application starts, the reachability correctly indicates network access (be that up or down) and I also receive notifications as expected.
If I simulate the network failing by turning of Wifi (Turn off wifi from the computers perspective) I correctly receive the notification that the network is no longer reachable. But when I turn Wifi back on again I receive another notification which also tells me that the network is no longer reachable - even though it is. In addition, the 'isReachable' method also reports incorrectly.
Note that I call isReachable immediately after the result of a notification from NSNotificationCentre. I also ask for isReachable calls on different threads (does this matter)? Occasionally I simply don't get reachability updates at all, and eventually the notifier just seems to stop working.
Any one have any thoughts on what I'm doing wrong here? Thanks!

How to simulate bad internet connection on simulator with code

I have downloaded Network Link Conditioner but is there a way I can test this with code? Preferably swift
I don't think so. Because you get the internet connection from the device itself. You can't say in your swift-code:
Hey I'd like to drop every second data-package to simulate a
package-lost rate.
The cause of that is, that you can't change the internet-connection from within your app-sandbox. That's why you need to use an app like NLC to simulate the connection.

how to hook ios connection changes

I'm working on a VOIP project.
My app uses reachability to listen when the connection changes and to re-register with SIP SERVER. Everything works well when the app is in the foreground.
But when My App enters the background, it can't catch connection changes. At least 10 minutes later (when keepAlive runs) my app can check the connection again.
I intend to look at connection changes (lost wifi, 3G change to wifi, wifi to 3G, ...) using a private framework and mobile substrate. I've tried many methods but have not found a working one yet.
Does anyone know which method will be called when connection changes ?
Thank you
i think only Reachability class is better for this even apple use this class for his code please see this Link in this code you find. you answer some how
I found a question from someone going through a similar scenario:
How to get Reachability Notifications in iOS in Background when dropping Wi-Fi network?
Hope this helps.
Make sure your app is setup to do VoIP in the background. In your Info.plist file. Add the following key value pair:
See also: https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

Resources