问题
We are looking for a way to timeout an iPhone application, and have tried several methods:
NSTimer that resets after an action LocalNotification that resets after an action
Both are close, but suffer from unique issues:
NSTimer: When the phone sleeps, the timer will not fire LocalNotification: When the app is in the background, the notification is displayed, we don't have a way to have the application have to receive the notification.
Asking the group if this sounds correct, or if there is maybe some point above that I am missing that would allow this to work.
Thanks in advance!
回答1:
You do realize that when your app is in a suspended state, you won't receive any notifications -- and this is right in the documentation. There are only 3 classes of applications that can receive notifications: Audio applications (like iPod and analogues), location based applications, and voip apps. Your plist has to be set up correctly if your app is one of those applications.
来源:https://stackoverflow.com/questions/3249151/notification-when-program-is-in-background-ios-4