We have an app that among other things installs a Personal VPN. This has been working fine for many years but recently we have gotten reports from customers that they are getting an error when installing the VPN. This has only started happening on iOS/iPadOS 17. I hadn't been able to reproduce the issue myself until I tried on an iPad with iPadOS 17.1.1 installed and this actually ties in with one of the customer reports.
When I get the error I see the following:
Xcode debug console:
Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 90 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 90 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
Failed to save configuration [App Name]: Error Domain=NEConfigurationErrorDomain Code=10 "permission denied" UserInfo={NSLocalizedDescription=permission denied} Failed to save configuration: Error Domain=NEVPNErrorDomain Code=5 "permission denied" UserInfo={NSLocalizedDescription=permission denied}
Mac Console:
Saving configuration [App Name] with existing signature (null)
Failed to save configuration [App Name]: Error Domain=NEConfigurationErrorDomain Code=10 "permission denied" UserInfo={NSLocalizedDescription=permission denied} Failed to save configuration: Error Domain=NEVPNErrorDomain Code=5 "permission denied" UserInfo={NSLocalizedDescription=permission denied}
When the error occurs you don't even see the system prompt to allow the VPN be installed. We are using the code below to save the configuration and as stated it fails when trying saveToPreferences without ever showing the prompt
private func setup(with vpnProtocol: NEVPNProtocol, rules: [NEOnDemandRule], completion: @escaping VPNConfigurationCompletionHandler) {
let setupBlock: (NEVPNManager) -> () = {manager in
manager.isEnabled = true
manager.isOnDemandEnabled = true
manager.localizedDescription = L("app.vpn.description")
manager.protocolConfiguration = vpnProtocol
manager.onDemandRules = rules
manager.saveToPreferences { (error) in
completion(self.extractErrorCode(from: error))
}
}
vpnManager.loadFromPreferences { (error) in
if error == nil {
setupBlock(self.vpnManager)
} else {
completion(.generalFailure)
}
}
}
Any suggestions as to what may be going wrong?
Thanks Alan