objective c - iOS : Present a notification when the background treatment is finished -
i want display user notification displayed when application ends background treatment.
this code use :
uilocalnotification* localnotification = [[uilocalnotification alloc]init]; localnotification.alertbody = @"your uploads finished"; [[uiapplication sharedapplication]presentlocalnotificationnow:localnotification];
but not works, when called endbackgroundtask, don't see notification. however, used breakpoints, , code executed.
//identify application state through local notification uiapplicationstate state = [[uiapplication sharedapplication] applicationstate]; if (state==uiapplicationstateinactive) { //show notification text voice uilocalnotification *notification = [[uilocalnotification alloc]init]; [notification setalertbody:"title"]; notification.soundname = uilocalnotificationdefaultsoundname; notification.alertaction = @"view"; [[uiapplication sharedapplication] schedulelocalnotification:notification]; }
Comments
Post a Comment