gpt4 book ai didi

macos - NEVPNManager.saveToPreferencesWithCompletionHandler 上的错误

转载 作者:行者123 更新时间:2023-12-03 17:41:38 26 4
gpt4 key购买 nike

我的目标平台是 OS X 10.10/Xcode 7.2
我正在尝试保存 NEVPNManager 的首选项,但在域 = NEConfigurationErrorDomain 中出现错误:

Error Domain = NEConfigurationErrorDomain Code = 10 "permission denied" UserInfo = 0x610000073280 {NSLocalizedDescription = permission denied}

示例代码如下:
let manager = NEVPNManager.sharedManager()
manager.loadFromPreferencesWithCompletionHandler { (error) -> Void in
if((error) != nil) {
print("VPN load preferences error")
print(error!)
exit(0)
}
if manager.`protocol` == nil {
let proto = NEVPNProtocolIKEv2()
proto.serverAddress = "host.net"
proto.username = "username"
Keychain.save("vpnpassword", data: "password".dataUsingEncoding(NSUTF8StringEncoding)!)
proto.passwordReference = Keychain.load("vpnpassword") // I got the same error without passwordReference too
proto.authenticationMethod = NEVPNIKEAuthenticationMethod.None
manager.`protocol` = proto
manager.enabled = true
manager.localizedDescription = "VPN"
manager.saveToPreferencesWithCompletionHandler({ (error) -> Void in
if((error) != nil) {
print("VPN Save to Preferences error")
print(error!)
exit(0)
}
else {
do {
try manager.connection.startVPNTunnel()
print("Started error")
} catch {
print("Unexpected error")
}
}
}
})
}
})

我还发现了下一个日志条目:
Jan 10 14:24:51 y.local nehelper[196]: app has the com.apple.developer.networking.vpn.api entitlement but not the application-identifier entitlement
Jan 10 14:24:51 y.local nehelper[196]: app Failed to obtain authorization right for 3: no authorization provided
Jan 10 14:24:51 y.local app[33627]: __55-[NEVPNManager saveToPreferencesWithCompletionHandler:]_block_invoke142: failed to save the new configuration: Error Domain=NEConfigurationErrorDomain Code=10 "permission denied" UserInfo=0x608000660240 {NSLocalizedDescription=permission denied}

我有下一个权利
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.application-identifier</key>
<string>T76ZSM474A.app</string>
<key>com.apple.developer.aps-environment</key>
<string>development</string>
<key>com.apple.developer.networking.vpn.api</key>
<array>
<string>allow-vpn</string>
</array>
<key>com.apple.developer.team-identifier</key>
<string>T76ZSM474A</string>
<key>com.apple.security.application-groups</key>
<array>
<string>T76ZSM474A.</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>T76ZSM474A.group</string>
</array>
</dict>
</plist>

和下一个 xcent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.application-identifier</key>
<string>T76ZSM474A.vpn</string>
<key>com.apple.developer.aps-environment</key>
<string>development</string>
<key>com.apple.developer.networking.vpn.api</key>
<array>
<string>allow-vpn</string>
</array>
<key>com.apple.developer.team-identifier</key>
<string>T76ZSM474A</string>
<key>com.apple.security.application-groups</key>
<array>
<string>T76ZSM474A.</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>T76ZSM474A.group</string>
</array>
</dict>
</plist>

Embedded.provisionprofile 具有 allow-vpn 和正确的团队 ID (T76ZSM474A)

构建的应用程序具有下一个协同设计输出
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.application-identifier</key>
<string>T76ZSM474A.app</string>
<key>com.apple.developer.aps-environment</key>
<string>development</string>
<key>com.apple.developer.networking.vpn.api</key>
<array>
<string>allow-vpn</string>
</array>
<key>com.apple.developer.team-identifier</key>
<string>T76ZSM474A</string>
<key>com.apple.security.application-groups</key>
<array>
<string>T76ZSM474A.</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>T76ZSM474A.group</string>
</array>
</dict>
</plist>

我试图反编译 Network.framework,但这并不容易。
我在 OS X 10.11 上检查了这个问题,但没有发现问题,我的应用程序运行正常。
我将构建的应用程序从 OS X 10.11 复制到 OS X 10.10,但出现了之前的错误。
我认为该文档有错误,并且 OS X 10.10 中不支持 NEVPNManager 或 OS X 10.10 上的 NEVPNManager 存在错误。

我做错了什么?

最佳答案

我很长时间与 Apple 支持人员会面了。
他们说——NEVPNManager 在 10.10 上并不完全可用。
您应该升级到 OS X El Capitan 或使用 Strongswan Frontend for OS X ( https://wiki.strongswan.org/projects/strongswan/wiki/MacOSX )。

关于macos - NEVPNManager.saveToPreferencesWithCompletionHandler 上的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34817008/

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