ios - Notification bug or something else -
i'm generating notifications inside loop, why local notification actions show on first 2 created notifications?
here code:
uimutableusernotificationaction *notificationaction1 = [[uimutableusernotificationaction alloc] init]; notificationaction1.identifier = notificationactiononeident; notificationaction1.title = nslocalizedstring(@"marcar como feito", nil) ; notificationaction1.activationmode = uiusernotificationactivationmodebackground; notificationaction1.destructive = no; notificationaction1.authenticationrequired = no; uimutableusernotificationaction *notificationaction2 = [[uimutableusernotificationaction alloc] init]; notificationaction2.identifier = notificationactiontwoident; notificationaction2.title = @"snooze"; notificationaction2.activationmode = uiusernotificationactivationmodebackground; notificationaction2.destructive = yes; notificationaction2.authenticationrequired = yes; uimutableusernotificationaction *notificationaction3 = [[uimutableusernotificationaction alloc] init]; notificationaction3.identifier = notificationactionthreeident; notificationaction3.title = @"reply"; notificationaction3.activationmode = uiusernotificationactivationmodeforeground; notificationaction3.destructive = no; notificationaction3.authenticationrequired = yes; uimutableusernotificationcategory *notificationcategory = [[uimutableusernotificationcategory alloc] init]; notificationcategory.identifier = notificationcategoryident; [notificationcategory setactions:@[notificationaction1,notificationaction2,notificationaction3] forcontext:uiusernotificationactioncontextdefault]; [notificationcategory setactions:@[notificationaction1,notificationaction2,notificationaction3] forcontext:uiusernotificationactioncontextminimal]; nsset *categories = [nsset setwithobjects:notificationcategory, nil]; uiusernotificationtype notificationtype = uiusernotificationtypebadge | uiusernotificationtypesound | uiusernotificationtypealert; uiusernotificationsettings *notificationsettings = [uiusernotificationsettings settingsfortypes:notificationtype categories:categories]; [[uiapplication sharedapplication] registerusernotificationsettings:notificationsettings]; uilocalnotification* localnotification = [[uilocalnotification alloc] init]; int r = rand() % 30; localnotification.firedate = [nsdate datewithtimeintervalsincenow:r]; localnotification.alertbody = @"test"; localnotification.userinfo = nil; localnotification.category = notificationcategoryident; //same category identifier [[uiapplication sharedapplication] schedulelocalnotification:localnotification]; this making me crazy :)
Comments
Post a Comment