2016-03-31 37 views
1

我們試圖從一個閉包中呈現一個UIAlertController,但得到錯誤「隱式使用自閉在閉包中,使用self。使捕獲語義特定」。什麼是正確的語法在這裏?Swift:Present UIAlertController in closure

enter image description here

+1

做'self.showViewController(...)'。當你在一個塊內談論你的實例變量時,你需要明確地調用self。 –

+0

謝謝,現在明白了 –

回答

3

您需要參考「自我」明確地談論一個塊中的對象的實例變量的時候。

self.showViewController(...)