ios - Cancel LocalNotifications method not executing when user closes/exits the app -


i'm testing on ios 8.4 on xcode simulator , on iphone 6. notifications work fine , fire perfectly. can't figure out how cancel notifications when user quits/closes app. pressing home button should not cancel notifications , should still fire notification.

this have tried.

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {  [application registerusernotificationsettings:[uiusernotificationsettings settingsfortypes:uiusernotificationtypealert|uiusernotificationtypebadge|uiusernotificationtypesound categories:nil]];  return yes; 

}

[[uiapplication sharedapplication] cancelalllocalnotifications]; 

for below method - cancels notifications when user presses home button or closes app not want.

- (void)applicationdidenterbackground:(uiapplication *)application  

for below method - notifications not cancel home button or closing app.

- (void)applicationwillenterforeground:(uiapplication *)application 

for below method - not execute method @ home button or closing app.

- (void)applicationwillterminate:(uiapplication *)application 

i have looked other similar questions posted on stack overflow can't seem of suggestions work. please advise.

once fire notification registered in os. os presents notification in time. cant delete notification after application terminated. no method called @ time of termination.

when notification arrives if app in foregroung didreceivelocalnotification method called.

if in background didlaunchwithoption method called.

if app terminated no method called.

you fire silent notification , present actual notifications when receive silent notifications in these methods. can use userinfo identify notifications.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -