Open plkgq opened 3 years ago
Hi @plkgq,
Looking at the exception it seems to me that you are trying to store NEPacketTunnelFlow
object into some special storage like UserDefaults or tunnel settings. And as the exception message said it is not possible because this object doesn't adopt NSSecureCoding
protocol.
As for cocoapods, thanx for suggestion, although I think it would be better to define additional subspec so at the end we would have one for extension, and one for client app. I'll fix it when I have enough spare time.
Thank you very much for your reply I double-checked my code and found no special storage
I just executed [self.vpnAdapter connectUsingPacketFlow:self.packetFlow];
Ahhh... I see what's wrong. In 0.7.0 version delegate's API has changed, in openVPNAdapter(_:configureTunnelWithNetworkSettings:completionHandler:)
you use packetFlow
as completion handler argument. But now completion handler accepts NSError
that returned by setTunnelNetworkSettings
. Here how it could be done in Swift:
func openVPNAdapter(
_ openVPNAdapter: OpenVPNAdapter,
configureTunnelWithNetworkSettings networkSettings: NEPacketTunnelNetworkSettings?,
completionHandler: @escaping (Error?) -> Void
) {
networkSettings?.dnsSettings?.matchDomains = [""]
setTunnelNetworkSettings(networkSettings, completionHandler: completionHandler)
}
Thank you again for your reply. I seem to know how to fix it.
Before that, I returned the wrong object. When I changed it to this, it worked,
but there was another problem. I found that I disconnected the network and reconnected. Later, it does not work, but I see in the log that the connection has been established, but the network is unavailable. It seems that some configuration has not been updated. I want to know how to fix it.
thank :)
Hello, Mr. Author, first of all thank you very much for the open plugin you provided, However, some problems occurred in the project upgrade recently (from 0.5.1 to 0.7.0)
The following is the problem I have on my iOS device In the oc version, NEPacketTunnelFlow has already followed the OpenVPNAdapterPacketFlow protocol, but errors still occur. I guess there should be some problems in the type conversion, but I don’t know how to solve it.
In the swift version, there are some different problems
In addition, I found that you use APPLICATION_EXTENSION_API_ONLY in your pod project, which makes it compatible with other projects. I need to manually remove it after each install. If APPLICATION_EXTENSION_API_ONLY is not necessary, I suggest removing it. This It will be better compatible with pod projects
Looking forward to your reply