Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm thinking of doing an alarm clock for iPhone with music as alarm sound.
I have also evaluated similar apps.
They all seems to share the same limitation.
If the app is not active when the alarm is triggered music cannot be played.

So the question, is this a limitation in iOS ?

share|improve this question
    
Programming questions like this should be on Stack Overflow. –  CajunLuke May 18 '12 at 17:43
add comment

1 Answer

up vote 3 down vote accepted

If the app is not the active running app, then, unless it meets strict criteria, it cannot start itself to perform such an action. There are a number of limitations for VOIP apps and music players to allow them to stay running, but in your case what would probably work best is a local notification that uses a custom notification sound. This allows you to register a notification for the time of the alarm which will be triggered regardless, as it will not be your app doing the work, but the OS instead which obviously maintains the notifications daemon at all times. Certainly for a "real" push notification you can then have a custom sound, I recall the demo at the relevant WWDC where an ESPN app used a clip of music from their TV channel as the sound, but I am unsure if you can acheive the same with a local one - I don't see any reason why not. Obviously there will be limits on file size and possibly length also, so a full track of music may not be possible.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.