swift - Show reminder(alarm) like custom alert and perform user action on that alert in IOS -


i want show reminder alert user in particular time . , perform action on alert view . used local notification show reminder showing badge style message when app running in background . need alternate solution . thank in advance...

in appdelegate should write ( app , example, use code according app )

func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool {     let completeaction = uimutableusernotificationaction()     completeaction.identifier = "complete_todo" // unique identifier action     completeaction.title = "complete" // title action button     completeaction.activationmode = .background // uiusernotificationactivationmode.background - don't bring app foreground     completeaction.authenticationrequired = false // don't require unlocking before performing action     completeaction.destructive = true // display action in red      let remindaction = uimutableusernotificationaction()     remindaction.identifier = "remind"     remindaction.title = "remind in 30 minutes"     remindaction.activationmode = .background     remindaction.destructive = false      let todocategory = uimutableusernotificationcategory() // notification categories allow create groups of actions can associate notification     todocategory.identifier = "todo_category"     todocategory.setactions([remindaction, completeaction], forcontext: .default) // uiusernotificationactioncontext.default (4 actions max)     todocategory.setactions([completeaction, remindaction], forcontext: .minimal) // uiusernotificationactioncontext.minimal - when space limited (2 actions max)      application.registerusernotificationsettings(uiusernotificationsettings(fortypes: .alert | .badge | .sound, categories: nsset(array: [todocategory]))) // we're providing set containing our category argument     return true   } 

for more information go link :- http://jamesonquave.com/blog/local-notifications-in-ios-8-with-swift-part-2/


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -