• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Preventing system sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preventing system sleep


  • Subject: Re: Preventing system sleep
  • From: Joe Ranieri <email@hidden>
  • Date: Tue, 16 Feb 2010 16:19:31 -0500

On 2/16/10 4:18 PM, Laurent Daudelin wrote:
On Feb 16, 2010, at 13:13, Joe Ranieri wrote:

On 2/16/10 4:10 PM, Neil Allain wrote:

On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:

I'm working on a an app that at some point might start transferring a large file to a USB device. Apparently, if the system is set to go to sleep, the transfer will fail.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc says "Currently unimplemented".

So, if my app get a notification that the system is going to sleep, how can I delay it?


You can call UpdateSystemActivity() periodically (such as on a timer) to prevent it from going to sleep.

Neil

You should probably be using IOPMAssertionCreateWithName() instead if you can require 10.5+. This gives the system a lot more information about the intent of your code and the potential ability to show some nice UI to the user.

Oops! The doc says it was introduced in 10.6 and I need to support 10.5. I guess I'll have to check "IOPMAssertionCreate"...

Thanks!

Curious. The header file says:
IOReturn IOPMAssertionCreateWithName(
CFStringRef AssertionType,
IOPMAssertionLevel AssertionLevel,
CFStringRef AssertionName,
IOPMAssertionID *AssertionID) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;


Is the header wrong?

-- Joe Ranieri
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Preventing system sleep
      • From: "Sean McBride" <email@hidden>
    • Re: Preventing system sleep
      • From: Laurent Daudelin <email@hidden>
References: 
 >Preventing system sleep (From: Laurent Daudelin <email@hidden>)
 >Re: Preventing system sleep (From: Neil Allain <email@hidden>)
 >Re: Preventing system sleep (From: Joe Ranieri <email@hidden>)
 >Re: Preventing system sleep (From: Laurent Daudelin <email@hidden>)

  • Prev by Date: Re: Preventing system sleep
  • Next by Date: Re: Perform additional action when window receives any mouse- orkeyDown
  • Previous by thread: Re: Preventing system sleep
  • Next by thread: Re: Preventing system sleep
  • Index(es):
    • Date
    • Thread