In accordance with the rules, I suspend timers (I have my own suspendable
timer wrapper class for NSTimer) and I terminate comm links when in the
background.  No problem.  It works.  I get notifications when it
re-activates and can re-establish comm.  Unfortunately, when the iPad screen
goes down, so does the comm link, but there is no notification when it comes
back up to allow re-initialzing the comm link, Bonjour, etc., and be able to
reconnect from the other side.

Currently, my instructions to the users, in such case, is to switch out the
app, then switch back.  That works, because then I get notification.

Someone had a suggestion that I run a repeating 1 sec. timer and store
current time.  If it ever shows being more than, say 2 sec. behind, then
that means it woke up, so reset the comm link.  That might work.


On 2/15/11 2:25 PM, "Matt Neuburg" <m...@tidbits.com> wrote:

> On Sat, 12 Feb 2011 13:01:28 -0600, Gordon Apple <g...@ed4u.com> said:
>> If it exists, could somebody point me to notifiers for sleep/wake in iOS?
>> 
>> I have a comm link that goes down with sleep.  I would like to bring it up
>> again on wake (in case the user forgot to disable sleep).  I'm already doing
>> this for applicationWillEnterForeground, but that doesn't work for sleep.
> 
> What is "sleep" in iOS? The user can lock the screen, but that might or might
> not cause the device to sleep, depending on a zillion other factors. Many
> things can continue happening in the background. The whole concept is a shaky
> one.
> 
> If your app is backgrounded, you'll be suspended (freeze-dried) and all your
> code will come to a complete stop, unless you take certain special measure
> that qualify you for prevention of this (e.g. you're producing background
> audio). In that case you'll get applicationWillEnterForeground when coming
> back to the front.
> 
> If the screen is locked and your app was in the background, it was already
> suspended and you're covered.
> 
> If the question is "How can I cover the case where the screen was locked and
> is now being unlocked and my app is *frontmost*", that is your app becoming
> *active*. Basically for long continuous activities you should pause when the
> app becomes inactive and resume when the app becomes active again. Indeed, you
> will also get the active notification when entering the foreground, so it is a
> very good all-around place to cover resuming from interruptions of any kind.
> m.
> 
> --
> matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/>
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to