ios - UILocalNotification wants permission to show, but it is already granted -
ios - UILocalNotification wants permission to show, but it is already granted -
i allowing remote , local notifications
in app, works fine remote notifications
when trying utilize local notifications
not show notification, running code.
remote notifications work when out of app, local notifications don't want show when in app?
here code:
in didfinishlaunchingwithoptions
method:
let notificationtypes:uiusernotificationtype = uiusernotificationtype.badge | uiusernotificationtype.sound | uiusernotificationtype.alert allow notificationsettings:uiusernotificationsettings = uiusernotificationsettings(fortypes: notificationtypes, categories: nil) uiapplication.sharedapplication().registerusernotificationsettings(notificationsettings) uiapplication.sharedapplication().registerforremotenotifications()
and receiving of notification:
if(application.applicationstate == uiapplicationstate.active) { var ln: uilocalnotification = uilocalnotification() ln.userinfo = userinfo ln.soundname = uilocalnotificationdefaultsoundname ln.alertbody = notification["alert"] nsstring ln.firedate = nsdate() application.schedulelocalnotification(ln) println("local") } else { pfpush.handlepush(userinfo) }
when in app, printing out local
.
any ideas?
it sounds don't quite local notification is. whole point of local notification is way scheme notify user on behalf when app isn't frontmost. if app is frontmost, there nil more scheme do. local notifications, therefore, not fire alert user when app frontmost. instead, if app frontmost when local notification fires, app notified , you can alert user if like.
ios notifications uilocalnotification
Comments
Post a Comment