ios - Receive push when app is closed -


I am trying to save a data that comes with a push notifications payload. It works well when the app is running, but when the app is not closed.

How can I save data from Push Notification for SQLite when the app is completely off and in the background do not.

I get this code, while the application closes and receives a push notification

  - (zero) application: (UIApplication *) application didReceiveRemoteNotification : NSDictionary *) userInfo fetchCompletionHandler: (zero (^) (UIBackgroundFetchResult)) completionHandler {// Save Data NSLog (@ "receive remote notifcation:% @", userInfo); (NSString * key [userInfo AllKeys]) {NSString * data = [userInfo objectForKey: key]; NSLog (@ "Inserted for notification ...% @ ---->% @", key, data); } Query = [NSString stringWithFormat: @ "Log in account (email address) value ('% @')", data; Sqlite3_stmt * Compiled Statement; If sqlite3_prepare_v2 (mydb, [query UTF8String], -1, & amp; compiledStatement, zero) == SQLITE_OK {inserting error data during {SQLTE_DONE = sqlite3_step (compiledStatement)} {NSLog (@ ": '% s '", Sqlite3_errmsg (mydb)); } And {nslog (@ "new data inserted"); Isneed = @ "yes"; } Sqlite3_reset (compiled location); } Else {NSLog (error in entering "% s", sqlite3_errmsg (mydb))}}  

Comments