gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:08:46 26 4
gpt4 key购买 nike

我使用的是 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com