[英]Value of type 'UITableView' has no member 'navigationController' swift iOS
[英]iOS Swift: Value of type 'NotificationCenter' has no member 'publisher'
我正在尝试将新的Combine框架与Notification Center一起使用,正如Apple在此视频中所解释的那样: https : //developer.apple.com/videos/play/wwdc2019/721/
您可以在幻灯片21中找到它。
看来我的项目没有读取Combine框架apis。
import Combine
import Foundation
let trickNamePublisher = NotificationCenter.default.publisher(for: .newTrickDownloaded)
我收到这个错误:
“NotificationCenter”类型的值没有成员“发布者”
显然,在Xcode 11测试版中存在以下问题:
Combine框架的Foundation集成不可用。 以下Foundation和Grand Central Dispatch与Combine的集成不可用:KeyValueObserving,NotificationCenter,RunLoop,OperationQueue,Timer,URLSession,DispatchQueue,JSONEncoder,JSONDecoder,PropertyListEncoder,PropertyListDecoder和@Published属性包装器。 (51241500)
链接: https : //developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_release_notes/
事实上,他们并没有在演示期间使用Xcode,而只是幻灯片上的代码
此问题已通过Xcode 11 beta 2修复。 来自Xcode 11 Beta 2发行说明 :
现在可以使用Combine框架的Foundation集成。 可以使用以下Foundation和Grand Central Dispatch与Combine的集成:KeyValueObserving,NotificationCenter,RunLoop,OperationQueue,Timer,URLSession,DispatchQueue,JSONEncoder,JSONDecoder,PropertyListEncoder,PropertyListDecoder和@Published属性包装器。 (51241500)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.