これがコードです...
login().then {
// our login method wrapped an async task in a promise
return API.fetchKittens()
}.then { fetchedKittens in
// our API class wraps our API and returns promises
// fetchKittens returned a promise that resolves with an array of kittens
self.kittens = fetchedKittens
self.tableView.reloadData()
}.catch { error in
// any errors in any of the above promises land here
UIAlertView(…).show()
}
then
メソッドが何も返さないことを確認してください。
コンパイラを使用then
すると、約束を返さなければならないと言っています。しないという選択肢がないのはなぜですか?
直後に catch 句を追加すると、エラーはなくなります。は?