 | | happydoze V2EX member #37426, joined on 2013-04-12 11:25:46 +08:00 |
happydoze's recent replies
那自己回答吧,不知道为什么,只有异步才成功。不知道是不是线程的问题。有知道答案的人分析一下么
贴一下成功的代码
```swift
func signIn4() {
Task {
do {
let cOntent= try await getShareableContent()
guard let display = content.displays.first else { return }
print(display)
let filter = SCContentFilter(display: display, excludingWindows: [])
let cOnfig= SCStreamConfiguration()
config.minimumFrameInterval = CMTime(value: 1, timescale: 10)
let stream = SCStream(filter: filter, configuration: config, delegate: nil)
let output = Output()
try stream.addStreamOutput(output, type: .screen, sampleHandlerQueue: nil)
try await stream.startCapture()
try await Task.sleep(nanoseconds: 200_000_000)
try await stream.stopCapture()
} catch {
print("Failed to retrieve capturable content or start stream: \(error.localizedDescription)")
}
}
}
func getShareableContent() async throws -> SCShareableContent {
return try await withCheckedThrowingContinuation { continuation in
SCShareableContent.getWithCompletionHandler { content, error in
if let error = error {
continuation.resume(throwing: error)
} else if let cOntent= content {
continuation.resume(returning: content)
}
}
}
}
```
40 岁.最近入职的时候我也是有些犹豫,所以查了老板的信息,60 岁了,限制高消费,
司法案件 7 、被执行人 1 、立案信息 3 、裁判文书 7 、
自身风险 2 、关联提醒 90 、 历史风险 8 、敏感舆情 2 、 提示信息 60
他这一轮融到了 800 万,又赤膊上阵了.
无名之辈:不是拼了命走到生命的尾