Comments (8)
I'll look into this, but one note, you dont need to stop/start the notifier when you go to the background, it'll work fine if you just start it at app startup and leave it running. (which is what I do).
I dont actually have an iOS5 device but I have a couple of theories I'll test.
from reachability.
I start and stop the notifier based on either specific advice from a WWDC session or just the general recommendation to turn off unnecessary things when the app isn't active or foreground - I don't remember which. I assume that it has an impact on battery life as well, but I'm not sure if in reality it does. If there's no effect, I can change that code although there may be other possible issues such as: https://github.com/AFNetworking/AFNetworking/issues/512.
I think the difference is that you schedule the notifications with a queue (SCNetworkReachabilitySetDispatchQueue) and the other Reachability code I've used in the past (Apple Reachability and AFNetworking) schedules them on a runloop (SCNetworkReachabilityScheduleWithRunLoop). Maybe there's an iOS 5 specific issue with SCNetworkReachabilitySetDispatchQueue although I haven't been able to find anyone else reporting it online.
I'm not able to replicate yet, although I do get a few crash reports for this everyday from my iOS 5 users. I've tried testing with an iPad 1 (5.1.1) using the Network Link Conditioner (though an iPhone hotspot) and mixed in some memory warnings as well without luck.
If you have some ideas or theories, let me know. Thanks for your time!
from reachability.
Yeah there is no need (and no effect on battery life) to stop the reachability notifier when moving to background, it was originally build for a VoIP app so it was designed to just stay running all the time (iOS is very clever about background processing)
Reachability was originally designed for iOS5 so unless a new change has broken backwards compatibility it should work fine. If I can find an iOS5 device among my test units I will definitely test it.
from reachability.
Ever find out why this crash occurred? We're having the same issue.
from reachability.
It's an issue with the dispatch queue setup. It happens even if you don't use the queue based reachability methods and only affects iOS 5.
I switched to the following Reachability code and haven't had an crashes since:
https://gist.github.com/darkseed/1182373
from reachability.
Thank @soleares, I'll check it out. We're using iOS5 specifically for a project.
from reachability.
Running into this issue too. This appears to be caused by this reachability library posting notifications on the main thread. If the observers for that notification check reachability status they will invariably be calling SCNetworkReachabilityGetFlags, which according to Apple's Docs should not be called on the main thread because it might require a DNS lookup and could take over 30 seconds and so trigger iOS Application Watchdog, that will kill the app for hanging.
Here's the reference: https://developer.apple.com/Library/ios/samplecode/Reachability/Listings/ReadMe_txt.html
Fix would be to ensure that the observer methods use GCD to react to reachability status on a separate thread.
from reachability.
I'm closing this as I definitely don't support iOS5 any more
from reachability.
Related Issues (20)
- Tag a release? HOT 6
- Reachability does not detect switching between wifi networks HOT 2
- Always detecting ReachableViaWiFi 'TRUE' in iOS 11 HOT 3
- connection vpn and always callback noreachable
- NSNotification.Name.reachabilityChanged does not work HOT 1
- warning of leak in Xcode
- SIGABRT in TMReachabilityCallback HOT 1
- Why NetworkStatus rawValue dose not match to the Apple's Reachability ?
- iOS12 bug, API cannot callback normal! HOT 1
- Airplane mode with shadowsocks return reachable
- Attempted to dereference garbage pointer HOT 1
- Crash on iOS 12 (Crashed: com.tonymillion.reachability)
- Not work on iOS 13.2.3, iPad Mini 4 HOT 1
- add support to swift package manager
- Symbol not found HOT 2
- Semantic issue cast from pointer to smaller type 'unsigned int' loses information when compile source as Objective-C++
- SCNetworkReachabilityCreateWithAddress Thread 1: EXC_BAD_ACCESS (code=2, address=0x16b04bff0)
- iOS14 always get reachable on 4G with wrong hostname HOT 1
- Uio
- cast to smaller integer type 'unsigned int' from 'Reachability *' [-Wpointer-to-int-cast] NSStringFromClass([self class]), (unsigned int) self, [self currentReachabilityFlags]]; HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reachability.