ios - 推送通知中不播放声音

标签 ios ios7

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

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

下面是Skype的:

enter image description here

你看,我的应用程序没有“声音”部分。

有人能帮忙吗?


更新:

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

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

但是在我进入我的应用程序设置后,最初有一个像 Skype 一样的“声音”部分,但是后来 Preference 应用程序崩溃了,之后就没有更多的“声音”了,就像下面这样: enter image description here

会不会是苹果的bug?

最佳答案

您没有在您的应用程序中注册音频推送通知。只需在您的 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

这是文档:Registering for Remote Notifications

希望对您有所帮助!

关于ios - 推送通知中不播放声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20849566/

相关文章:

ios - iPad/iOS7 : 'Page' modal view controller strange behaviour after presenting 'Full screen' view controller from it

iOS 7 : different navigation items for tab bar controller

ios - 无法在 IOS 中多次执行 X 分钟的函数调用

iphone - 将视频从 youtube 应用分享到我在 ios 上的应用

ios - CGContext 初始化后不绘制

ios - 带有附件下载 API 支持的一次性临时电子邮件

objective-c - 将补充标题 View 添加到 UICollectionView 时出错

ios - 特殊符号在 UIAlertView 中不起作用

android - 用户正确登录后在应用程序中使用 JWT

ios - 如何在不重叠状态栏的情况下在 iOS7 上呈现 View Controller