![](/img/trans.png)
[英]'Receiver type “CCParticleBatchNode” for class message is a forward declaration'
[英]Receiver type "WkAlertAction" for class message is a forward declaration
該錯誤告訴您僅聲明了有問題的類,但未找到定義。 例如,如果您在標頭中使用@class WKAlertAction
聲明一個類,因為它是參數的類型,就會發生這種情況。 但是,一旦您嘗試實際使用它,即向實現中的對象發送消息,就會收到此錯誤,因為編譯器找不到該類的實際定義。
沒有看到你的整個代碼,我不能肯定地說,但我猜你只是忘記了包含框架或模塊。 確保你有@import WatchKit;
在相關范圍內的某個地方,即可能在您看到錯誤的實現文件中。
我正在搜索 swift 並彈出這個問題,所以我會在使用時添加對我有用的 swift 結果
let action1 = WKAlertAction.init(title: "Cancel", style:.cancel) {
print("cancel action")
}
let action2 = WKAlertAction.init(title: "default", style:.default) {
print("default action")
}
let action3 = WKAlertAction.init(title: "destructive", style:.destructive) {
print("destructive action")
}
presentAlert(withTitle: "Alert Title", message: "message is here", preferredStyle:.actionSheet, actions: [action1,action2,action3])
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.