gpt4 book ai didi

objective-c - networkextension 不导入较新的版本

转载 作者:行者123 更新时间:2023-11-28 07:25:10 25 4
gpt4 key购买 nike

我正在尝试在 xcode 10 ios12 中使用 networkextension基本上,我已经导入了它,它应该来自 ios12,它有一个额外的功能( startVPNTunnelwithOptions )我可以覆盖它。但相反,xcode 似乎将其链接到旧版本。现在,如果我尝试覆盖它,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

enter image description here

startVPNTunnelWithOptions 方法在自定义的 PacketTunnelProvider.m 中我有一个桥头文件来桥接它以下是桥文件中的内容

#import "../ConnectTunnel/PacketTunnelProvider.h"

我在这里错过了什么?

最佳答案

- (BOOL)startVPNTunnelWithOptions:(NSDictionary<NSString *,NSObject *> *)options 
andReturnError:(NSError * _Nullable *)error;

此方法在 objc 中可用,在 swift 3 中已废弃目标文档链接: https://developer.apple.com/documentation/networkextension/nevpnconnection/1406061-startvpntunnelwithoptions?language=objc

在 swift 3+ 中,函数被重命名为 func startVPNTunnel(options: [String : NSObject]? = nil) throws

快速文档链接: https://developer.apple.com/documentation/networkextension/nevpnconnection/1406061-startvpntunnel

关于objective-c - networkextension 不导入较新的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56814046/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com