Search code examples
ios7apple-push-notifications

Stopping ios 7 remote notification sound


In iOS 7, when a user swipes one of my notifications from the lockscreen and is taken to my app, the notification sound keeps playing (unlike iOS 6). Is there any way to programmatically stop that sound when my app launches in iOS 7?

NOTE: see the accepted answer for a shoddy workaround.


Solution

  • I'm pretty sure this is a bug on Apple's end, see devforums.apple.com/message/888091 (thanks Gui13). File a duplicate bug report to get Apple to pay attention to it, as that is how Apple assigns priority to bugs. In the meantime, the following will work but will also clear all of your notifications in the notification center, which of course is a shoddy workaround, but in my case is worth it until this gets fixed:

    [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 1];    
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];