Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9516] iOS: scheduleLocalNotification crash app - Ti SDK - > 2.0

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-06-21T12:25:42.000+0000
Affected Version/sRelease 2.0.2, Release 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-13 API
ComponentsiOS
Labelsapi, community, module_notification_manager, qe-testadded
ReporterJean-Sébastien GALLOO
AssigneeBlain Hamon
Created2012-06-07T03:07:53.000+0000
Updated2012-07-16T12:21:23.000+0000

Description

1> Please note that it was working fine under Ti mobile 1.7.3 2> My app uses a background service initialized in app.js: var service = Ti.App.iOS.registerBackgroundService({ url: 'background.js' }); And in background.js, I launch local notifications when needed to alert user: var notification = Ti.App.iOS.scheduleLocalNotification({...}); When coming back to foreground, App is frozen and then crash. 3> The problem seems to be similar to http://developer.appcelerator.com/question/133472/sdk-182-localnotification-crash. and is very annoying...because at the present time, i have to remove localnotifications from app.

Comments

  1. Betty Tran 2012-06-12

    Hi Jean-Sébastien, Would it be possible to provide a code sample that reproduces the bug? Thanks, Betty
  2. Jean-Sébastien GALLOO 2012-06-12

    Hi, here is sample test code. I tested it. Notification is displayed then app frozes and crash. -> Sometimes, first time after being displayed and click "display" (app), it works then going background again crash the app. -> if you refuse to display app after notification then click on app icon, it crashes a few seconds after. This bug leads to no possible notification information given to user about background processes (in my case, photo transfer to server when going to background mode) Files: app.js & background.js ******************* ** app.js ** ******************* var tabGroup = Ti.UI.createTabGroup(); var win1= Ti.UI.createWindow({ title:"Tab1", url:'./win1.js' }); var tab1=Ti.UI.createTab({ title:'Tab1', window: win1 }); var win2= Ti.UI.createWindow({ title:"Tab2", url:'./win1.js' }); var tab2=Ti.UI.createTab({ title:'Tab2', window: win2 }); tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.open(); // not written but first check if iOS>=4 before creating service var service = Ti.App.iOS.registerBackgroundService({ url: 'background.js' }); ******************* ** background.js ** ******************* var notification = Ti.App.iOS.scheduleLocalNotification({ alertBody:"Hello notif", date: new Date(new Date().getTime()+3000) // 3 seconds after backgrounding }); Thanks for working on this bug !
  3. Betty Tran 2012-06-13

    I can not reproduce the bug using Ti SDK 2.0.1GA2 and 2.0.2GA. Here is the code I used:
       //app.js
       
       var tabGroup = Ti.UI.createTabGroup();
       var win1= Ti.UI.createWindow({ title:"Tab1" });
       var tab1=Ti.UI.createTab({ title:'Tab1', window: win1 });
       var win2= Ti.UI.createWindow({ title:"Tab2"});
       var tab2=Ti.UI.createTab({ title:'Tab2', window: win2 });
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
       tabGroup.open();
       
       // not written but first check if iOS>=4 before creating service
       var service = Ti.App.iOS.registerBackgroundService({ url: 'background.js' });
       
       //background.js
       
       var notification = Ti.App.iOS.scheduleLocalNotification({ alertBody:"Hello notif", date: new Date(new Date().getTime()+3000)});
       
  4. Jean-Sébastien GALLOO 2012-06-13

    Hi, I used Mac OS X Lion - Ti Studio v 2.0.3.201206051048 - Ti Mobile up to 2.1.0.v20120510171759 (from 2.0.2.v20120505151714) (from builds.appcelerator.com.s3.amazonaws.com/index.html in branch master) Where can i only upload Ti SDK 2.0.1GA2 and 2.0.2GA ? Thanks
  5. Betty Tran 2012-06-13

    The latest officially released SDK can be downloaded via Titanium Studio by going to help > check for Titanium SDK updates. I would recommend using only the SDK versions obtained this way as there is support provided for them.
  6. Jean-Sébastien GALLOO 2012-06-13

    When i do help > check for Titanium SDK updates, last Ti SDK update is not proposed that's why I asked. What is the alternative way to download it ? Thanks
  7. Betty Tran 2012-06-13

    Check if you already have the latest SDK. Titanium should automatically download the latest SDKs (guide: https://wiki.appcelerator.org/display/tis/Downloading+Titanium+SDKs+in+Titanium+Studio). Try to install the latest version of Studio from here: http://titanium-studio.s3.amazonaws.com/latest/Titanium_Studio.dmg.
  8. Jean-Sébastien GALLOO 2012-06-13

    Just to be sure. When app goes on background then open app, I click on tab 1 then tab2 then tab1 and app freezes and crash. You dont get this behavior at all ? thanks.
  9. Betty Tran 2012-06-13

    Yes, doing this crashes the app.
  10. Abhishek Tiwari 2012-06-18

    I am facing the same issue on my App. Local notifications are critical to my app and this issue has made this feature useless. I tried all the recommended remedies to no avail. Please treat this as Sev 1 and address it ASAP!! Here is a recommendation, which hasnt worked for me 1.8.2, 2.0.1.GA2 and 2.0.2
  11. Abhishek Tiwari 2012-06-18

    Betty, In the background.js file, please put the following in a function var notification = Ti.App.iOS.scheduleLocalNotification({ alertBody:"Hello notif", date: new Date(new Date().getTime()+3000)}); That will help you reproduce the issue each time. Abhishek
  12. Jose Carlos Andreu 2012-06-20

    Appcelerator: Please resolve this issue ASAP, it's been there since 1.8.2 at least ( @jsgallo states it's even before) and it makes the app crash, which can lead to AppStore rejections. After struggling with this issue I found a workaround that has worked for me. Use this module: https://github.com/benbahrenburg/LocalNotify It handles notifications in a different way and it even lets you check which ones are active and haven't been fired.
  13. Neeraj Gupta 2012-06-20

    We are looking at issue now.
  14. Blain Hamon 2012-06-21

    Turns out I've [fixed](https://github.com/appcelerator/titanium_mobile/commit/2774f7e589dd237c04791b9edee4e47929eb977d) this when testing [PR #2383](https://github.com/appcelerator/titanium_mobile/pull/2383). So huzzah, it's already in 2.1.0.
  15. Blain Hamon 2012-06-21

    This was fixed in an earlier sprint, so will be in 2.1.0 despite being marked as sprint 13. See git history of linked bug.
  16. Michael Pettiford 2012-06-23

    Tested with Ti Studio build 2.1.0.201206221045 Ti Mobile SDK 2.1.0.v20120622174154 hash rdc9dfbe5 OSX Lion 10.7.3 iPhone 4S OS 5.1

JSON Source