QuickBlox / quickblox-ios-sdk

QuickBlox iOS SDK for messaging and video calling
https://quickblox.com/developers/IOS
MIT License
396 stars 358 forks source link

Request failed: client error (422) on sendVoipPush #1362

Closed Maks273 closed 1 year ago

Maks273 commented 1 year ago

I'm calling from Ukraine to UK and get next. It's working well when calling in Ukraine. Could you help me to figure about what's wrong pls?

Error reasons:{ errors = { base = ( "No recipients. At least one user should be subscribed for 'apnsvoip' (through SDK or REST API)" ); }; }

Request failed: client error (422)

djmckee commented 1 year ago

Yep I have found this issue in inverse too πŸ‘

Maks273 commented 1 year ago

I got success here

let deviceIdentifier = UIDevice.current.identifierForVendor?.uuidString
        let subscription = QBMSubscription()
        subscription.notificationChannel = chanel
        subscription.deviceUDID = deviceIdentifier
        subscription.deviceToken = token
        QBRequest.createSubscription(subscription, successBlock: { _, _ in
            completion(true)
        }) { errorResponse in
            Crashlytics.crashlytics().log("ERROR createSubscription = \( errorResponse.error?.error?.localizedDescription ?? "")")
            completion(false)
        }
IlliaChemolosov commented 1 year ago

ΠŸΡ€ΠΈΠ²Ρ–Ρ‚, @Maks273!

Π‘Π»Π°Π²Π° Π£ΠΊΡ€Π°Ρ—Π½Ρ–!

Ця ΠΏΠΎΠΌΠΈΠ»ΠΊΠ° Π²ΠΊΠ°Π·ΡƒΡ” Π½Π° Ρ‚Π΅, Ρ‰ΠΎ користувач, якому ΠΉΠ΄Π΅ Π΄Π·Π²Ρ–Π½ΠΎΠΊ, Π½Π΅ ΠΌΠ°Ρ” підписки Π½Π° voip push-сповіщСння.

Π£ Ρ‚Π²ΠΎΡ”ΠΌΡƒ Π²ΠΈΠΏΠ°Π΄ΠΊΡƒ ΠΌΠΎΠΆΠ΅ Π±ΡƒΡ‚ΠΈ ΠΊΡ–Π»ΡŒΠΊΠ° ΠΏΡ€ΠΈΡ‡ΠΈΠ½ Ρ‚Π°ΠΊΠΎΡ— ΠΏΠΎΠ²Π΅Π΄Ρ–Π½ΠΊΠΈ. Π™ΠΌΠΎΠ²Ρ–Ρ€Π½ΠΎ, Ρ†Π΅ ΠΏΠΎΠ²'язано Π· Ρ€Ρ–Π·Π½ΠΈΠΌΠΈ сСрСдовищами (environments): тСстовим (test) Ρ‡ΠΈ ΠΆΠΈΠ²ΠΈΠΌ (live). Π¦Π΅ ΠΌΠΎΠΆΠ΅ Π·Π°Π»Π΅ΠΆΠ°Ρ‚ΠΈ Π²Ρ–Π΄ Π·Π±Ρ–Ρ€ΠΊΠΈ Π±Ρ–Π»Π΄Π° (develop Π°Π±ΠΎ production). Π’Π°ΠΊΠΈΠΌ Ρ‡ΠΈΠ½ΠΎΠΌ, Ρƒ Ρ‚Π΅Π±Π΅ ΠΌΠΎΠΆΠ΅ Π²ΠΈΠ½ΠΈΠΊΠ½ΡƒΡ‚ΠΈ ситуація, ΠΊΠΎΠ»ΠΈ "develop to develop" Ρ‡ΠΈ "prod to prod" Π΄Π·Π²Ρ–Π½ΠΊΠΈ ΠΏΡ€Π°Ρ†ΡŽΡŽΡ‚ΡŒ, Π°Π»Π΅ "develop to prod" - Π½Ρ–.

Π‘ΠΏΠΎΡ‡Π°Ρ‚ΠΊΡƒ Ρ€Π°Π΄ΠΆΡƒ ΠΏΠ΅Ρ€Π΅Π²Ρ–Ρ€ΠΈΡ‚ΠΈ, Ρ‡ΠΈ Π²ΠΈΠΊΠΎΡ€ΠΈΡΡ‚ΠΎΠ²ΡƒΡŽΡ‚ΡŒΡΡ Π±Ρ–Π»Π΄ΠΈ, підписані Ρ€Ρ–Π·Π½ΠΈΠΌΠΈ сСртифікатами.

IlliaChemolosov commented 1 year ago

Hello @djmckee!

This error indicates that the user receiving the call does not have a subscription for voip push notifications.

In your case, there could be several reasons for this behavior, most likely due to different environments (test or live). It directly depends on the build (develop or production). So, you may have a situation where "develop to develop" or "prod to prod" calls work, but "develop to prod" does not. First and foremost, I recommend checking if you are using builds signed with different certificates.

Maks273 commented 1 year ago

ГСроям Π‘Π»Π°Π²Π°! @IlliaChemolosov

Π’Π°ΠΊ, ΠΏΡ€ΠΈΡ‡ΠΈΠ½Π° Π· сСрСдовищами Ρ”! АлС ΠΏΠΎΠΌΡ–Ρ‚ΠΈΠ², ΠΊΠΎΠ»ΠΈ Ρ‚Π΅Π»Π΅Ρ„ΠΎΠ½ΡƒΠ²Π°Π² Π· dev to prod, Ρ‚ΠΎ Ρ†Π΅ΠΉ Π°ΠΊΠΊΠ°ΡƒΠ½Ρ‚ Π²ΠΈΠ΄Π°Ρ” Ρ‚Π°ΠΊΡƒ саму ΠΏΠΎΠΌΠΈΠ»ΠΊΡƒ ΠΊΠΎΠ»ΠΈ Ρ‚Π΅Π»Π΅Ρ„ΠΎΠ½ΡƒΡŽ Π· dev => dev

Π’Π΅ΠΏΠ΅Ρ€ протСстував 2 Π°ΠΊΠΊ Π½Π° Π΄Π΅Π²Ρ– Ρ– всС ΠΏΡ€Π°Ρ†ΡŽΡ”, Π°Π»Π΅ Π½Π° test flight Π½Ρ– :( ΠΎΡ‚Ρ€ΠΈΠΌΡƒΡŽ 422 error

Maks273 commented 1 year ago

@IlliaChemolosov so the issue is when I testing on test flight. Any tips to check what's causing the issue?

IlliaChemolosov commented 1 year ago

Hello @Maks273! Maybe you're currently using a sandbox certificate. I recommend creating a universal certificate and updating it within the QuickBlox admin panel.

Maks273 commented 1 year ago

@IlliaChemolosov could you send a link to that article pls?

IlliaChemolosov commented 1 year ago

@Maks273 https://docs.quickblox.com/docs/ios-push-notifications#generate-a-certificate-signing-request

Maks273 commented 1 year ago

@IlliaChemolosov do I need to generate aspn cer or it can be voip one?

IlliaChemolosov commented 1 year ago

@Maks273 It varies based on your app's requirements, especially if you need to receive regular pushes, such as when the app is in the background and notifications arrive. Typically, I create a universal certificate that supports both calls and regular messages (voip and apns). However, you can create individual certificates and add them depending on your requirements, our admin panel supports up to 3 certificates.