We have an iOS and MacOS VPN app that both use a PacketTunnelProvider
app extension. Right now we are trying to replace our MacOS app with a Mac Catalyst version of our iOS app using the same bundle identifiers as the old MacOS app so it can read existing configurations.
One issue we run into while testing the Mac Catalyst application through TestFlight is that if a user has an existing VPN profile that was created using the old MacOS app and is now running the new version, the app extension that is bundled with the Mac Catalyst app does not load.
default 2024-01-16 23:35:57.642543 -0500 neagent Looking for an extension with identifier org.outline.macos.client.VpnExtension and extension point com.apple.networkextension.packet-tunnel
info 2024-01-16 23:35:57.642774 -0500 neagent [d <private>] <PKHost:0x7f79e9a06080> Query: {
"LS:ExtensionPlatforms" = (
1,
6
);
NSExtensionIdentifier = "org.outline.macos.client.VpnExtension";
NSExtensionPointName = "com.apple.networkextension.packet-tunnel";
}
default 2024-01-16 23:35:57.644424 -0500 neagent Found 1 extension(s) with identifier org.outline.macos.client.VpnExtension and extension point com.apple.networkextension.packet-tunnel
default 2024-01-16 23:35:57.645454 -0500 neagent Beginning extension request with extension org.outline.macos.client.VpnExtension
error 2024-01-16 23:35:57.645714 -0500 neagent Plugin <id<PKPlugIn>: 0x7f79e9915c50; core = <[u 7C82B460-9B3B-460E-939D-45837EC68385] [org.outline.macos.client.VpnExtension(0.0.0-debug)],[d 07098DE9-4C17-4D0D-A4D4-8B399A374D8C] [/Users/sbruens/Library/Developer/Xcode/DerivedData/ios-hevczjegdwwzgfauwbictbyosask/Build/Products/Debug-maccatalyst/Outline.app/Contents/PlugIns/VpnExtension.appex]>, instance = [(null)], state = 0, useCount = 0> must have pid! Extension request will fail
error 2024-01-16 23:35:57.645771 -0500 neagent Failed to acquire assertion for plugin: <id<PKPlugIn>: 0x7f79e9915c50; core = <[u 7C82B460-9B3B-460E-939D-45837EC68385] [org.outline.macos.client.VpnExtension(0.0.0-debug)],[d 07098DE9-4C17-4D0D-A4D4-8B399A374D8C] [/Users/sbruens/Library/Developer/Xcode/DerivedData/ios-hevczjegdwwzgfauwbictbyosask/Build/Products/Debug-maccatalyst/Outline.app/Contents/PlugIns/VpnExtension.appex]>, instance = [(null)], state = 0, useCount = 0> pid: 0
error 2024-01-16 23:35:57.645812 -0500 neagent Unable to acquire process assertion in beginUsing: with plugin identifier: org.outline.macos.client.VpnExtension, killing plugin
error 2024-01-16 23:35:57.645840 -0500 neagent PlugInKit error in beginUsing: with plugin identifier: org.outline.macos.client.VpnExtension, killing plugin
error 2024-01-16 23:35:57.645879 -0500 neagent begin extension request <EXExtensionRequest: 0x7f79e9c13130> Request PK UUID: 35311654-AC47-428C-90BD-E90625A2215D with item count 0 complete with error: Error Domain=PlugInKit Code=16 "other version in use: <id<PKPlugIn>: 0x7f79eb50d9a0; core = <[u B6730DEE-7340-40B1-AEE5-42BE0AA48831] [org.outline.macos.client.VpnExtension(0.0.0-debug)],[d 27607659-3EB5-425C-A1EB-B450209E124A] [/Users/sbruens/Library/Developer/Xcode/DerivedData/ios-hevczjegdwwzgfauwbictbyosask/Build/Products/Debug-maccatalyst/Outline.app/Contents/PlugIns/VpnExtension.appex]>, instance = [(null)], state = 1, useCount = 1>" UserInfo={NSLocalizedDescription=other version in use: <id<PKPlugIn>: 0x7f79eb50d9a0; core = <[u B6730DEE-7340-40B1-AEE5-42BE0AA48831] [org.outline.macos.client.VpnExtension(0.0.0-debug)],[d 27607659-3EB5-425C-A1EB-B450209E124A] [/Users/sbruens/Library/Developer/Xcode/DerivedData/ios-hevczjegdwwzgfauwbictbyosask/Build/Products/Debug-maccatalyst/Outline.app/Contents/PlugIns/VpnExtension.appex]>, instance = [(null)], state = 1, useCount = 1>}
default 2024-01-16 23:35:57.645944 -0500 neagent Extension request with extension org.outline.macos.client.VpnExtension started with identifier (null)
error 2024-01-16 23:35:57.646121 -0500 neagent Failed to start extension org.outline.macos.client.VpnExtension: Error Domain=PlugInKit Code=16 "other version in use: <id<PKPlugIn>: 0x7f79eb50d9a0; core = <[u B6730DEE-7340-40B1-AEE5-42BE0AA48831] [org.outline.macos.client.VpnExtension(0.0.0-debug)],[d 27607659-3EB5-425C-A1EB-B450209E124A] [/Users/sbruens/Library/Developer/Xcode/DerivedData/ios-hevczjegdwwzgfauwbictbyosask/Build/Products/Debug-maccatalyst/Outline.app/Contents/PlugIns/VpnExtension.appex]>, instance = [(null)], state = 1, useCount = 1>" UserInfo={NSLocalizedDescription=other version in use: <id<PKPlugIn>: 0x7f79eb50d9a0; core = <[u B6730DEE-7340-40B1-AEE5-42BE0AA48831] [org.outline.macos.client.VpnExtension(0.0.0-debug)],[d 27607659-3EB5-425C-A1EB-B450209E124A] [/Users/sbruens/Library/Developer/Xcode/DerivedData/ios-hevczjegdwwzgfauwbictbyosask/Build/Products/Debug-maccatalyst/Outline.app/Contents/PlugIns/VpnExtension.appex]>, instance = [(null)], state = 1, useCount = 1>}
The only way around that seems to be to manually remove the app's VPN configuration under Network > VPN & Filter and restart the machine. Then the Mac Catalyst app can start a tunnel with a new profile (after asking the user for permissions) without issue. However, this is not a great user experience and I've been trying to fix this properly. I read Debugging a Network Extension Provider and all related forum posts and developer docs, and could use some help at this point.
One issue we run into while testing the Mac Catalyst application through TestFlight is that if a user has an existing VPN profile that was created using the old MacOS app and is now running the new version, the app extension that is bundled with the Mac Catalyst app does not load.
That doesn’t surprise me. Internally, iOS and macOS use different techniques for identifying code and it’s easy to see how a macOS-style link in the configuration to the provider would fail to find an iOS-style provider.
The only way around that seems to be to manually remove the app's VPN configuration
So removing the configuration programmatically using NEVPNManager
doesn’t work?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"