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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -