Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ios/Classes/SwiftTwilioVoicePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ public class SwiftTwilioVoicePlugin: NSObject, FlutterPlugin, FlutterStreamHand
_ = updateCallKitIcon(icon: defaultIcon)

voipRegistry.delegate = self
voipRegistry.desiredPushTypes = Set([PKPushType.voIP])
// Only set PushKit types if available (requires PushKit entitlement)
if #available(iOS 8.0, *) {
voipRegistry.desiredPushTypes = Set([PKPushType.voIP])
}

UNUserNotificationCenter.current().delegate = self

let appDelegate = UIApplication.shared.delegate
guard let controller = appDelegate?.window??.rootViewController as? FlutterViewController else {
fatalError("rootViewController is not type FlutterViewController")
NSLog("Warning: FlutterViewController not available during Twilio Voice plugin init, event channel setup will be skipped")
return
}
let registrar = controller.registrar(forPlugin: "twilio_voice")
if let unwrappedRegistrar = registrar {
Expand Down