networkextension 不导入较新的版本
networkextension does not import newer version
我正尝试在 xcode 10 ios12 中使用网络扩展
基本上,我已经导入了它,它应该来自 ios12,它有一个额外的功能( startVPNTunnelwithOptions )我可以覆盖它。
但相反,xcode 似乎 link 它是旧版本。现在,如果我尝试覆盖它,xcode 一直告诉我使用 startVPNTunnel
Replace 'startVPNTunnelWithOptions(' with 'startVPNTunnel(options:
1. 'startVPNTunnelWithOptions' was obsoleted in Swift 3 (NetworkExtension.NEVPNConnection)
如上面的消息所示,xcode 似乎使用的是 swift3 而不是 4.2 或 5。
但我使用的是最新的 xcode 和 macOS,我什至将项目开发目标设置为 12.2,在 Swift lang 中我设置为 swift5
startVPNTunnelWithOptions 方法是自定义的 PacketTunnelProvider.m
我有一个桥头文件来桥接它
以下是桥文件中的内容
#import "../ConnectTunnel/PacketTunnelProvider.h"
我在这里错过了什么?
- (BOOL)startVPNTunnelWithOptions:(NSDictionary<NSString *,NSObject *> *)options
andReturnError:(NSError * _Nullable *)error;
此方法在 objc 中可用,在 swift 3 中已废弃
目标文档 link:
https://developer.apple.com/documentation/networkextension/nevpnconnection/1406061-startvpntunnelwithoptions?language=objc
在swift 3+中函数被重命名为func startVPNTunnel(options: [String : NSObject]? = nil) throws
Swift 文档 link:
https://developer.apple.com/documentation/networkextension/nevpnconnection/1406061-startvpntunnel
我正尝试在 xcode 10 ios12 中使用网络扩展 基本上,我已经导入了它,它应该来自 ios12,它有一个额外的功能( startVPNTunnelwithOptions )我可以覆盖它。 但相反,xcode 似乎 link 它是旧版本。现在,如果我尝试覆盖它,xcode 一直告诉我使用 startVPNTunnel
Replace 'startVPNTunnelWithOptions(' with 'startVPNTunnel(options:
1. 'startVPNTunnelWithOptions' was obsoleted in Swift 3 (NetworkExtension.NEVPNConnection)
如上面的消息所示,xcode 似乎使用的是 swift3 而不是 4.2 或 5。
但我使用的是最新的 xcode 和 macOS,我什至将项目开发目标设置为 12.2,在 Swift lang 中我设置为 swift5
startVPNTunnelWithOptions 方法是自定义的 PacketTunnelProvider.m 我有一个桥头文件来桥接它 以下是桥文件中的内容
#import "../ConnectTunnel/PacketTunnelProvider.h"
我在这里错过了什么?
- (BOOL)startVPNTunnelWithOptions:(NSDictionary<NSString *,NSObject *> *)options
andReturnError:(NSError * _Nullable *)error;
此方法在 objc 中可用,在 swift 3 中已废弃 目标文档 link: https://developer.apple.com/documentation/networkextension/nevpnconnection/1406061-startvpntunnelwithoptions?language=objc
在swift 3+中函数被重命名为func startVPNTunnel(options: [String : NSObject]? = nil) throws
Swift 文档 link: https://developer.apple.com/documentation/networkextension/nevpnconnection/1406061-startvpntunnel