问题
Possible Duplicate:
Force app to close and run in background
I'm creating an radio application in ios. There is a minimize button in my application. So what I want to do is when user press that button the application should be run in the background and the app icon should be displayed in the notification area like normal Android
radio app. I want to know is it possible in iOS
and how can I do that. Any one can show me an example.
Thanks
回答1:
The only way to make ones application goes to background programatically is to open another app (Safari) calling its URL. But I don't think that is what you have in mind (since you are saying you have a radio app).
So if you want to imitate the same action which happens when user pressing home button, it is not possible with iOS SDK. From iOS human interface guildelines
Don’t Quit Programmatically
Never quit an iOS application programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your application from functioning as intended, you need to tell your users about the situation and explain what they can do about it.
Apple also says in the documentation
People, not applications, should initiate and control actions. Although an application can suggest a course of action or warn about dangerous consequences, it’s usually a mistake for the app to take decision-making away from the user. The best apps find the correct balance between giving people the capabilities they need while helping them avoid dangerous outcomes.
So I don't think it is possible using public API.
来源:https://stackoverflow.com/questions/14391784/how-to-minimize-an-ios-app