"property with 'retain(or strong)' attribute must be of object type caused by mutual inclusion in XCode

Although the advantage of XCode's #import over #include is to solve the problem of multiple inclusions, but today I still encountered the error

"property with 'retain(or strong)' attribute must be of object type" in the mutually included header files

. The

solution Very simple:

add

@class "xxxx" to the relevant header file

to solve it.

For example:
#import <Foundation/Foundation.h>
#import "Project.h"
#import "Member.h"

@class Member;
@class Project;

@interface Day : NSObject{

    ...
}
@end

The difference from C++ is that when this problem occurs, we don't need to delete the #import "xxx" header file where the problem occurs.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326614562&siteId=291194637