推送通知中不播放声音

时间:2013-12-30 23:56:32

标签: ios ios7

我正在使用iOS 7,我的推送通知不播放声音。

奇怪的是,我发现Preference>中没有声音设置。我的应用的通知中心。以下是我的应用程序通知中心的屏幕截图: enter image description here

以下是Skype的内容:

enter image description here

你知道,没有'声音'我的应用程序部分。

有人可以帮忙吗?


更新

现在我已经在我的应用程序中注册了声音。通知中心现在看起来像: enter image description here

我的通知有声音。看起来不错。

但在我输入我的应用设置后,最初会出现一个声音'像Skype这样的部分,然后Preference应用程序崩溃了,之后,没有更多的声音了,如下所示: enter image description here

这可能是Apple的错误吗?

1 个答案:

答案 0 :(得分:6)

您尚未在应用中注册音频推送通知。只需在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;
}

这5种类型是:

  1. UIRemoteNotificationTypeBadge
  2. UIRemoteNotificationTypeSound
  3. UIRemoteNotificationTypeAlert
  4. UIRemoteNotificationTypeNone
  5. UIRemoteNotificationTypeNewsstandContentAvailability
  6. 以下是文档:Registering for Remote Notifications

    希望有所帮助!

相关问题