objective c - how to recieve local notification in ios when app is closed -
I am using local notifications for alarm systems, but I have to face some problem handling local information The app is launched when I click on the alarm notification, the app is launched, but the problem is that it should go to the didFinishLaunchingWithOptions
function but it is appDelegate
Not going into any function in (I check Breakpoints were used). I am using the story board with the navigation controller, I want to open a special view controller when the notification is closed.
But when I launch that app, it's usually going to be inside please make a suggestion. pre> DEMOAppDelegate.m didFinishLaunchingWithOptions <
#import "DEMOAppDelegate.h" int main (int argc, char * argv []) {{@autoreleasepool UIApplicationMain return (argc, argv, zero, NSStringFromClass ([DEMOAppDelegate square])); }}
#import "DEMOAppDelegate.h" @implementation DEMOAppDelegate - (BOOL) Application :( UIApplication *) applied FinishLaunchingWithOptions: (NSDictionary *) launch Option {UILocalNotification * localNotif = [launch Option Objektforki: UIApplicationLaunchOptionsLocalNotificationKey]; If (localizational) {NSLog (@ "Information received @%", local notice); } Yes return; } - (void) applicationWillResignActive: (UIApplication *) application {} - (void) applicationDidEnterBackground: (UIApplication *) application {} - (void) applicationWillEnterForeground: (UIApplication *) application {} - ApplicationDidBecomeActive (zero): (UIApplication *) application {} - (void) applicationWillTerminate: (UIApplication *) application {} - (void) application: (UIApplication *) application didReceiveLocalNotification: (UILocalNotification *) notification {UIAlertView * alertView = [[UIAlertView alloc] initWithTitle: notification.alertAction message : Notification Alertbodi Representative: Cancel SelfTutatite: @ "OK" Other Button Titles: Nil]; [Show warning view]; } @end
This is not possible when your app is not running notifications It will not react directly to the notification.
didFinishLaunchingWithOptions
will contain information about the information when the user opens their app via this notification. If it cancels it and opens your app through the dashboard icon, then you will not see it in this method.
Unfortunately, if you need to react to all the notifications the user opens the app for the last time, the only way is to create your own tracking logic and get all the events based on time. Also, there is no way to get the list of scheduled notifications for your app, so it is usually a good idea to build and use the notification on time-based event logic, but All logic is based on your own time based code in this way, if the user disables notifications, then your important argument will work.
When the application is running in the background, you will receive a notification via the Application: didReiveiveRemoteNotification
. You can assemble those notifications within your app, and process them on applicationDidBecomeActive
if you want to make specific for the user after coming back from the background back to the app Are there.
Comments
Post a Comment