ios - UILocalNotification fired but not showing, or showing but not visible in notification center, or firing like a charm -


i've been struggling past few days on local notifications on app.

basically goal pop notification when user approches address.

here code:

nsmutablearray *notifications = [@[] mutablecopy]; (ccaddress *address in results) {     cccategory *category = [address.categories.allobjects firstobject];     nsdictionary *userinfo = @{@"addressid" : address.identifier};     uilocalnotification *localnotification = [uilocalnotification new];      if (category == nil)         localnotification.alertbody = [nsstring stringwithformat:@"vous ĂȘtes proche de %@", address.name];     else         localnotification.alertbody = [nsstring stringwithformat:@"vous ĂȘtes proche de %@, %@", address.name, category.name];     localnotification.alertaction = @"linotte";     localnotification.soundname = uilocalnotificationdefaultsoundname;     localnotification.userinfo = userinfo;      [notifications addobject:localnotification];      address.lastnotif = [nsdate date]; } [managedobjectcontext savetopersistentstore:null];  [uiapplication sharedapplication].scheduledlocalnotifications = notifications; 

the result totally random, there know sure: geofencing works well, can see set date of notification in lastnotif, know when fired.

sometimes see notification pop, doesn't stay in notification center, times nothing happens, if see date fired, , goes fine.

i tried many things, using presentlocalnotificationnow, setting firedate 1 second delay between each, , other things don't remember...

so, there missed in documentation, ?

thanks.

ps: app in background or off when happens, i'm aware of didreceivelocalnotification.

ps2: don't know if don't see @ fired, because don't show in notification center, maybe fired have absolutely no way see them if don't have phone's screen in sight when do.

edit: so, i've been doing tests around house, phone closed, screen locked. real syndrom when notification pops, turns screen on, , phone vibrates (i sound off), nothing...

i don't see you're setting firedate. can't recall defaults to.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -