Hi there,
Been writing a NEPacketTunnelProvider implementation, and currently trying to handle the case where a user calls the VPN directly from the system settings but there is an error in estabilishing the connection. The rationale here is to either provide a quick link back to the application for the user, or simply give them some feedback as to why a connection has failed should they choose to use the system preferences instead of the application. Looking around the documentation and developer forums have lead to different trains of thought and deprecated methods.
The first and most obvious method was the use of displayMessage(_:completionHandler:). This works for a simple error messsage but is now deprecated as of iOS 12.0 and macOS 10.14. Thus, this is not ideal.
Searching further, the closest post I could find was this one where the poster was recommended to make use of the UserNotifications framework. However when requesting authorization with requestAuthorization(options:completionHandler:) from the tunnel provider I am returned notificationNotAllowed- "Notifications are not allowed for this application".
Is this expected behaviour? The only indication from a comment from Apple Staff user "eskimo" in the post linked above (sorry I don't know of a way to directly link to that comment) was that they were "pretty sure they work from a packet tunnel provider", so I'm not sure if this is in fact not allowed or if I am simply doing something wrong?
Alternatively if a better/more conventional modern approach exists for notifying the user of an error, I'd be grateful for it to be pointed out.
Thanks!