[英]iOS Swift: Value of type 'NotificationCenter' has no member 'publisher'
I'm trying to use the new Combine framework with the Notification Center as Apple explained in this video: https://developer.apple.com/videos/play/wwdc2019/721/ 我正在尝试将新的Combine框架与Notification Center一起使用,正如Apple在此视频中所解释的那样: https : //developer.apple.com/videos/play/wwdc2019/721/
You can find it in the slide 21. 您可以在幻灯片21中找到它。
It seems that my project does not read the Combine framework apis. 看来我的项目没有读取Combine框架apis。
import Combine
import Foundation
let trickNamePublisher = NotificationCenter.default.publisher(for: .newTrickDownloaded)
And i'm getting this error: 我收到这个错误:
Value of type 'NotificationCenter' has no member 'publisher' “NotificationCenter”类型的值没有成员“发布者”
Apparently seems that in Xcode 11 beta there is this know issue: 显然,在Xcode 11测试版中存在以下问题:
The Foundation integration for the Combine framework is unavailable.
Combine框架的Foundation集成不可用。 The following Foundation and Grand Central Dispatch integrations with Combine are unavailable: KeyValueObserving, NotificationCenter, RunLoop, OperationQueue, Timer, URLSession, DispatchQueue, JSONEncoder, JSONDecoder, PropertyListEncoder, PropertyListDecoder, and the @Published property wrapper.
以下Foundation和Grand Central Dispatch与Combine的集成不可用:KeyValueObserving,NotificationCenter,RunLoop,OperationQueue,Timer,URLSession,DispatchQueue,JSONEncoder,JSONDecoder,PropertyListEncoder,PropertyListDecoder和@Published属性包装器。 (51241500)
(51241500)
link: https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_release_notes/ 链接: https : //developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_release_notes/
Indeed they weren't using Xcode during that presentation, but just code on slides 事实上,他们并没有在演示期间使用Xcode,而只是幻灯片上的代码
This issue has been fixed with Xcode 11 beta 2 . 此问题已通过Xcode 11 beta 2修复。 From Xcode 11 Beta 2 Release Notes :
来自Xcode 11 Beta 2发行说明 :
The Foundation integration for the Combine framework is now available.
现在可以使用Combine框架的Foundation集成。 The following Foundation and Grand Central Dispatch integrations with Combine are available: KeyValueObserving, NotificationCenter, RunLoop, OperationQueue, Timer, URLSession, DispatchQueue, JSONEncoder, JSONDecoder, PropertyListEncoder, PropertyListDecoder, and the @Published property wrapper.
可以使用以下Foundation和Grand Central Dispatch与Combine的集成:KeyValueObserving,NotificationCenter,RunLoop,OperationQueue,Timer,URLSession,DispatchQueue,JSONEncoder,JSONDecoder,PropertyListEncoder,PropertyListDecoder和@Published属性包装器。 (51241500)
(51241500)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.