我在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
有人知道这是什么以及如何修复它吗?
我一直在寻找这个问题,但在任何地方都找不到任何帮助。
1条答案
按热度按时间xoefb8l81#
不能再使用StreamNetworkServiceTypeValue.voIP创建套接字
此服务类型已在iOS 10中弃用。在iOS 14 SDK中,使用此服务类型会导致崩溃。