[英]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.