@@ -41,8 +41,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
41
41
// QR Code Mode
42
42
SendBirdCall . configure ( appId: appId)
43
43
}
44
-
45
- SendBirdCall . addDelegate ( self , identifier: " DelegateIdentification " )
44
+
45
+ // You must call `SendBirdCall.addDelegate(_:identifier:)` right after configuring new app ID
46
+ SendBirdCall . addDelegate ( self , identifier: " com.sendbird.calls.quickstart.delegate " )
46
47
47
48
self . voipRegistration ( )
48
49
@@ -63,13 +64,13 @@ extension AppDelegate: PKPushRegistryDelegate {
63
64
64
65
// MARK: SendBirdCalls - Registering push token.
65
66
func pushRegistry( _ registry: PKPushRegistry , didUpdate pushCredentials: PKPushCredentials , for type: PKPushType ) {
67
+ UserDefaults . standard. voipPushToken = pushCredentials. token
68
+ print ( " Push token is \( pushCredentials. token. toHexString ( ) ) " )
69
+
66
70
SendBirdCall . registerVoIPPush ( token: pushCredentials. token, unique: true ) { error in
67
71
guard error == nil else { return }
68
72
// Even if an error occurs, SendBirdCalls will save the pushToken value and reinvoke this method internally while authenticating.
69
73
}
70
- UserDefaults . standard. pushToken = pushCredentials. token
71
-
72
- print ( " Push token is \( pushCredentials. token. toHexString ( ) ) " )
73
74
}
74
75
75
76
// MARK: SendBirdCalls - Receive incoming push event
@@ -81,6 +82,17 @@ extension AppDelegate: PKPushRegistryDelegate {
81
82
func pushRegistry( _ registry: PKPushRegistry , didReceiveIncomingPushWith payload: PKPushPayload , for type: PKPushType , completion: @escaping ( ) -> Void ) {
82
83
// MARK: Handling incoming call
83
84
SendBirdCall . pushRegistry ( registry, didReceiveIncomingPushWith: payload, for: type) { uuid in
85
+ guard uuid != nil else {
86
+ let update = CXCallUpdate ( )
87
+ update. remoteHandle = CXHandle ( type: . generic, value: " invalid " )
88
+ let randomUUID = UUID ( )
89
+ self . provider. reportNewIncomingCall ( with: randomUUID, update: update) { error in
90
+ self . provider. reportCall ( with: randomUUID, endedAt: Date ( ) , reason: . failed)
91
+ }
92
+ completion ( )
93
+ return
94
+ }
95
+
84
96
completion ( )
85
97
}
86
98
}
0 commit comments