我们有错误:无法找到协议声明 'ClassWhichUseMainScene'[3]协议错误。找不到协议声明
我们创建的文件: Protocol.h
#import "ScoreSystem.h"
#import "OtherSystem"
#import "OtherSystem2"
@class ScoreSystem;
@protocol SceneDelegate <NSObject>
@property (nonatomic, readonly,retain) ScoreSystem* score;
@property (nonatomic, readonly,retain) OtherSystem* system;
@property (nonatomic, readonly,retain) OtherSystem2* system2;
@end
而且在ScoreSystem.h
#import "Protocol.h"
#import "OtherSystem"
#import "OtherSystem2"
@interface ScoreSystem: NSObject <SceneDelegate>
{
OtherSystem* system;
OtherSystem2* system2;
}
使用
在ScoreSystem中,我们只需要使用OtherSystem和OtherSystem2对象。在其他系统中使用ScoreSystem和OtherSystem2等。 我们希望为所有系统创建通用协议。
解决地雷问题需要明确的是,虽然,你可能仍然要导入的头在实现文件。 – Chuck 2012-03-27 08:32:10
@收集:很好。我要修改答案 – JeremyP 2012-03-27 08:33:22