HomeiOS DevelopmentVital notifications sound not taking part in OneSignal - ios

Vital notifications sound not taking part in OneSignal – ios


I am having problem that notifications sounds does not play, specifically for important notifications i am utilizing react native.

i have already got entitlement and approval from apple
i’ve the sound file .wav 3 seconds size within the root folder of the ios challenge
i obtain the important notifications however the sound does not play
i obtain the common notifications simply wonderful

i adopted all directions to implement onesignal into the app and it is working completely wonderful, the one problem is the sound not taking part in

that is the service file i up to date it to drive the quantity on however nonetheless no luck.

    import UserNotifications
import OneSignalExtension

class NotificationService: UNNotificationServiceExtension {
    var contentHandler: ((UNNotificationContent) -> Void)?
    var receivedRequest: UNNotificationRequest!
    var bestAttemptContent: UNMutableNotificationContent?

    override func didReceive(_ request: UNNotificationRequest,
                             withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {

        self.receivedRequest = request
        self.contentHandler = contentHandler
        self.bestAttemptContent = (request.content material.mutableCopy() as? UNMutableNotificationContent)

        guard let bestAttemptContent = bestAttemptContent else {
            contentHandler(request.content material)
            return
        }

        // Go by way of OneSignal
        OneSignalExtension.didReceiveNotificationExtensionRequest(
            self.receivedRequest,
            with: bestAttemptContent,
            withContentHandler: self.contentHandler
        )

        // ---- SAME AS OLD PROJECT ----
        // If payload comprises CRITICAL = YES → Drive iOS important sound
        if let important = request.content material.userInfo["CRITICAL"] as? String,
           important.uppercased() == "YES" {

            bestAttemptContent.sound =
                UNNotificationSound.defaultCriticalSound(withAudioVolume: 1.0)
        }

        contentHandler(bestAttemptContent)
    }

    override func serviceExtensionTimeWillExpire() {
        if let contentHandler = contentHandler,
           let bestAttemptContent = bestAttemptContent {

            OneSignalExtension.serviceExtensionTimeWillExpireRequest(
                self.receivedRequest,
                with: self.bestAttemptContent
            )
            contentHandler(bestAttemptContent)
        }
    }
}

Right here is my listing construction

Vital notifications sound not taking part in OneSignal – ios

am i lacking one thing ?

i attempted this answer Right here and nothing labored

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments