I have a ra开发者_运维知识库dio application on my iphone and i also add the option of setting alarm to play the radio at that time. Can i do that? And also after that i can add a sleep mode...
You would use UILocalNotification to set an alarm. But, if your application is not running or in the background, the system will display an alert and play a sound file up to 30 seconds in length. If you set an action for that alert, and that action can play the radio. But the user has to choose that action. You cannot have that action automatically play when the alert is triggered.
If your app is running in the foreground, then you can code for all situation you mention in your question.
精彩评论