Unexpected non-void return value in void function Swift3

后端 未结 2 563
花落未央
花落未央 2020-11-29 12:05

I have a function that returns either a class object or nil. The function\'s purpose is to check if a Chat exists. The chat ID\'s are stored in MySQL. If the ID

2条回答
  •  囚心锁ツ
    2020-11-29 12:16

    Your block is executed asynchronously, but you're trying to return a value from the enclosing function. It doesn't work that way. Your findChat function needs to take a completion block itself instead of returning a value, and then you can call that completion block from the point where you're trying to say return returnValue.

提交回复
热议问题