receiver type *** for instance message is a forward declaration

后端 未结 9 1254
心在旅途
心在旅途 2021-01-30 01:19

In my iOS5 app, I have NSObject States class, and trying to init it:

states = [states init];

here is init

9条回答
  •  天命终不由人
    2021-01-30 01:41

    That basically means that you need to import the .h file containing the declaration of States.

    However, there is a lot of other stuff wrong with your code.

    • You're -init'ing an object without +alloc'ing it. That won't work
    • You're declaring an object as a non-pointer type, that won't work either
    • You're not calling [super init] in -init.
    • You've declared the class using @class in the header, but never imported the class.

提交回复
热议问题