ios - Determining if a UILocalNotification was fired from scheduling or user interaction -


i'm trying determine different scenarios of uiapplication didreceivelocalnotification:. if user clicks notification while app inactive, should bring them corresponding ui page. otherwise, if user opened app without tapping notification, should let them stay in ui page left off from.

however, there little problem uilocalnotification scheduled myself.

[[uiapplication sharedapplication] schedulelocalnotification:scheduledalert]; 

so every time fired ios, call same delegate method callback when manually clicked notification on status bar:

- (void)application:(uiapplication *)application didreceivelocalnotification:(uilocalnotification *)notification { ... } 

i tried tricky hack such counting fired times while app inactive mode, counting 1 means ios firing, , counting 2 means user clicked, , relative counting management code.

but don't think best practice. checked ios messages application, has same functionality. if put app inactive mode, such scroll down status bar, can determine uilocalnotification touch (and open text editing mode) or return app (stay in previous status).

i appreciate if guys let me know best solution here!

i use custom key-value pair set nsmutabledictionary, assign uilocalnotification.userinfo, tell different scenarios.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -