“Expected method body” error

后端 未结 8 1390
天涯浪人
天涯浪人 2020-12-20 13:15

I had my application working fine, then without doing anything, out of nowhere I got 2 errors in appDelegate.h. One says this:

Expected

8条回答
  •  死守一世寂寞
    2020-12-20 14:00

    Try closing Xcode and then reopening and doing a clean build.

    If that doesn't fix it, it's possible you've got a circular reference in one of your header files.

    This can happen when foo.h #imports "bar.h" and bar.h #imports "foo.h" (or sometimes its a chain of three or more header files importing each other in a circle) and it leads to spurious errors like the one you're seeing.

    The solution is to try to avoid importing headers in your .h files, and instead use @class references for external classes in the .h files and put the #imports in the .m files instead.

提交回复
热议问题