Giter VIP home page Giter VIP logo

Comments (8)

tonymillion avatar tonymillion commented on May 23, 2024

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.

soleares avatar soleares commented on May 23, 2024

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.

tonymillion avatar tonymillion commented on May 23, 2024

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.

cerupcat avatar cerupcat commented on May 23, 2024

Ever find out why this crash occurred? We're having the same issue.

from reachability.

soleares avatar soleares commented on May 23, 2024

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.

cerupcat avatar cerupcat commented on May 23, 2024

Thank @soleares, I'll check it out. We're using iOS5 specifically for a project.

from reachability.

twumdjin avatar twumdjin commented on May 23, 2024

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.

tonymillion avatar tonymillion commented on May 23, 2024

I'm closing this as I definitely don't support iOS5 any more

from reachability.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.