ios - Local Notification custom sound NOT playing after OS8.3 -
as apple updated os 8.3 local custom sounds weren't playing.
i've done right, because worked <=8.2, code shouldn't issue, in case how i've created notifications:
fyi 30 sec or less
first converted them caf format using apples supplied code
then added project. have verified it's in resource bundle. have verified assigned target.
it's still not playing, did in previous os versions.
here schedule method:
- (void) schedulelocalnotification { nsstring *localnotificationsound; localnotificationsound = [[nsbundle mainbundle] pathforresource:@"clock" oftype:@".caf"]; uilocalnotification *timerdonenotification = [[uilocalnotification alloc] init]; timerdonenotification.soundname = localnotificationsound; timerdonenotification.alertbody = @"time up!"; timerdonenotification.alertaction = @"reset"; timerdonenotification.firedate = [nsdate datewithtimeintervalsincenow:secondsleft]; timerdonenotification.timezone = [nstimezone defaulttimezone]; [[uiapplication sharedapplication] schedulelocalnotification:timerdonenotification]; }
i didn't read part how has non localized resource:
you can package audio data in aiff, wav, or caf file. then, in xcode, add sound file project nonlocalized resource of app bundle.
so did wrap file name in stringwithformat
, started working post v8.3
timerdonenotification.soundname = [nsstring stringwithformat:@"%@", localnotificationsound];
Comments
Post a Comment