我想聲明一個指定初始化是這樣的:NS_DESIGNATED_INITIALIZER預期:(冒號)
- (instancetype)initWithDelegate:(id <MyDelegate>)delegate NS_DESIGNATED_INITIALIZER;
但它顯示我這個編譯錯誤:
Expected ':'
有趣的是,當我試圖把它寫像這樣(參考鏈接:Adopting Modern Objective-C) -
- (instancetype)init NS_DESIGNATED_INITIALIZER;
它顯示此錯誤:
Expected ';' after method prototype.
關於如何正確使用NS_DESIGNATED_INITIALIZER的任何想法?
? –