HanXu
HanXu

Reputation: 5597

Sound is not played in push notifications

I am using iOS 7 and my push notifications do not play sounds.

Strangely, I found there is no setting for sound in the Preference > Notification Center for my app. Following is the screenshots of Notification center for my app: enter image description here

And following is that for Skype:

enter image description here

You see, there is no 'Sounds' section for my app.

Could anyone help?


Update:

Now I have registered sound in my app. The Notification Center now looks like: enter image description here

and my notification has sounds. Looks good.

But after I enter the setting of my app, there is initially a 'Sounds' section like Skype, but then the Preference app crashed, and after that, there is no more 'Sounds', just like below: enter image description here

Might it be a bug of Apple?

Upvotes: 3

Views: 8973

Answers (1)

sridvijay
sridvijay

Reputation: 1526

You're not registered for audio push notifications in your app. Just register for it like this in your App Delegate:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //Whatever you have already in your app delegate...

    // Let device know you're going to be sending one of these types of notifications.
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
        (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

    return YES;
}

The 5 types are:

  1. UIRemoteNotificationTypeBadge
  2. UIRemoteNotificationTypeSound
  3. UIRemoteNotificationTypeAlert
  4. UIRemoteNotificationTypeNone
  5. UIRemoteNotificationTypeNewsstandContentAvailability

Here's the documentation: Registering for Remote Notifications

Hope that helps!

Upvotes: 6

Related Questions