Cannot find protocol declaration in Xcode

前端 未结 5 490
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 13:08

I\'ve experienced something today while I\'m building my app. I\'ve declared a protocol in my MyObject1 and add delegate property on it. I\'ve assign MyObject2 as a Delegat

相关标签:
5条回答
  • 2021-01-01 13:23

    Use '@class MyObject;' in order to avoid import loop.

    0 讨论(0)
  • 2021-01-01 13:35

    I've put my protocol declaration on separate file and import it on MyObject2

    0 讨论(0)
  • 2021-01-01 13:39

    The error is caused due to import loop.

    0 讨论(0)
  • 2021-01-01 13:44

    The error must be in import loop.

    I had import "AppDelegate.h" in both the classes.I removed it from the class which declared protocol and the error was gone. :)

    0 讨论(0)
  • 2021-01-01 13:45

    Are you doing an

    #import "NameOfDelegate.h" 
    

    At the top of your MyObject header?

    0 讨论(0)
提交回复
热议问题