Xcode 14 和 iOS 16 中的开放流问题 - 链接到现代 SDK,VOIP 套接字将不会唤醒。改用本地推送连接

问题描述 投票:0回答:1

我对 Xcode 14 和 iOS 16 有疑问。 当我启动应用程序时,应用程序立即崩溃。 我知道问题出在:

private var inputStream: InputStream!
private var outputStream: OutputStream!

创建流:

        var readStream:  Unmanaged<CFReadStream>?
        var writeStream: Unmanaged<CFWriteStream>?
        
        CFStreamCreatePairWithSocketToHost(nil, connectionConfiguration.host, connectionConfiguration.port, &readStream, &writeStream)

        inputStream = readStream!.takeRetainedValue()
        outputStream = writeStream!.takeRetainedValue()
        
        inputStream.setProperty(StreamSocketSecurityLevel.negotiatedSSL, forKey: .socketSecurityLevelKey)
        outputStream.setProperty(StreamSocketSecurityLevel.negotiatedSSL, forKey: .socketSecurityLevelKey)
        
        
        inputStream.setProperty(StreamNetworkServiceTypeValue.voIP, forKey: Stream.PropertyKey.networkServiceType)
        outputStream.setProperty(StreamNetworkServiceTypeValue.voIP, forKey: Stream.PropertyKey.networkServiceType)

配置流:

        inputStream!.delegate = self
        outputStream!.delegate = self
        inputStream!.schedule(in: .main, forMode: RunLoop.Mode.default)
        outputStream!.schedule(in: .main, forMode: RunLoop.Mode.default)

当我打开流时我崩溃了。

inputStream!.open()
outputStream!.open()

我需要这个流来连接后端。 来自 Xcode 的信息:

libsp.dylib`spd_checkin_socket.cold.1:
    0x21c764464 <+0>:  adrp   x8, 144598
    0x21c764468 <+4>:  adrp   x9, 0
    0x21c76446c <+8>:  add    x9, x9, #0xa3f            ; "Linked against modern SDK, VOIP socket will not wake. Use Local Push Connectivity instead"
    0x21c764470 <+12>: str    x9, [x8, #0x390]
->  0x21c764474 <+16>: brk    #0x1

有人知道它是什么以及如何修复它吗?

我正在搜索这个,但在任何地方都找不到解决这个问题的任何帮助。

ios swift xcode crash
1个回答
0
投票

您不能再使用 StreamNetworkServiceTypeValue.voIP 创建套接字

此服务类型在 iOS 10 中已弃用。在 iOS 14 SDK 中,使用此服务类型会导致崩溃。

© www.soinside.com 2019 - 2024. All rights reserved.