在整个应用程序中,当我设置 ViewController.delegate = self
时,我会收到语义问题警告。我已经搜索和发现类似的帖子,但没有一个能够解决我的问题。
ViewController.m:
GameAddViewController *gameAddViewContoller = [[navigationController viewControllers] objectAtIndex:0];
gameAddViewContoller.delegate=self;
当设置 .delegate=self
时,我得到错误消息。
返回文章页面 GameAddViewController.h:
@protocol GameAddViewControllerDelegate <NSObject>
- (void)gameAddViewControllerDidCancel:(GameAddViewController *)controller;
- (void)gameAddViewController:(GameAddViewController *)controller didAddGame:(Game *) game;
@end
@interface GameAddViewController : UITableViewController <GameAddViewControllerDelegate>
{
sqlite3 *pitchcountDB;
NSString *dbPath;
}
@property (nonatomic, strong) id <GameAddViewControllerDelegate> delegate;
...
@end
ViewController.h:
#import "GameAddViewController.h"
@class ViewController;
@protocol ViewControllerDelegate <NSObject>
- (void)ViewControllerDidCancel:(ViewController *)controller;
@end
@interface ViewController : UIViewController <ViewControllerDelegate>
-(void) checkAndCreateFile;
@end
有人能给我指出正确的方向来解决这些警告信息吗?