小编voo*_*doo的帖子

带有 Firebase 通知的自定义声音

我已将 Firebase 消息传递与我的 IOS 应用程序集成。我正在使用 Firebase 发送推送通知。我想将默认通知声音更改为我制作的自定义声音。我尝试了一些方法,但似乎没有任何效果。我找不到任何在线资源,请帮忙。这是我的代码:

    import UIKit
    import CoreData
    import Firebase
    import UserNotifications

    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    let gcmMessageIDKey = "gcm.message_id"


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        FirebaseApp.configure()
        UIApplication.shared.statusBarStyle = .lightContent
        Messaging.messaging().delegate = self

        if #available(iOS 10.0, *) {
            // For iOS 10 display notification (sent via APNS)
            UNUserNotificationCenter.current().delegate = self

            let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
            UNUserNotificationCenter.current().requestAuthorization(
                options: …
Run Code Online (Sandbox Code Playgroud)

apple-push-notifications ios firebase swift firebase-cloud-messaging

5
推荐指数
0
解决办法
677
查看次数