ios - Use variable instead of a string with Interactive Notifications -
i trying create notifications more 1 option user choose. have these working fine.
however don't want use hardcoded string title of option buttons. instead want use variable (which string), doesn't work!
let word1action = uimutableusernotificationaction() word1action.identifier = "word" word1action.title = "word" word1action.activationmode = uiusernotificationactivationmode.background word1action.destructive = false word1action.authenticationrequired = false in above code, "word" shows in notification button.
let word2action = uimutableusernotificationaction() word2action.identifier = "word_1" word2action.title = "0\(word_1)" word2action.activationmode = uiusernotificationactivationmode.background word2action.destructive = false word2action.authenticationrequired = false in above code, "0" shows on notification button.
let word3action = uimutableusernotificationaction() word3action.identifier = "word_2" word3action.title = word_2 word3action.activationmode = uiusernotificationactivationmode.background word3action.destructive = false word3action.authenticationrequired = false in above code, notification button blank.
so why basic string works?
i have verified variable using in fact string , getting no other errors, blank notifications.
any thoughts? ios restriction?
thanks!
ok, feel silly. had above code posted in appdelegate under
didfinishlaunchingwithoptions and since variables trying access global , had not been initiated yet showing blank.
guess needed 1 more cup of coffee today. ;-)
Comments
Post a Comment