我收到一个关于传递*const _strong到类型的语义问题的警告,id无论我改变什么,似乎无法修复它.
我目前有两个观点,并编写了这段代码.在iPadSpeckViewController.m中,这是应该在视图之间切换的方法:
-(IBAction) touchProducts {
ProductsViewController *controller = [[ProductsViewController alloc]
initWithNibName:@"Products" bundle:nil];
controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
controller.delegate = self;
[self presentModalViewController:controller animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
对于ProductsViewController.h:
@interface ProductsViewController : UIViewController {
id<ProductsViewControllerDelegate> delegate;
}
@property(nonatomic, retain)
IBOutlet id<ProductsViewControllerDelegate> delegate;
Run Code Online (Sandbox Code Playgroud)
ProductsViewController.m包含:
@synthesize delegate;
Run Code Online (Sandbox Code Playgroud)
但观点不转换......思考?
编辑:这是确切的警告,因为它显示在"controller.delegate = self;"行上 在iPadSpeckViewController.m中:
/Developer/iPadSpeckApp/iPadSpeckApp/iPadSpeckAppViewController.m:17:27:{17:27-17:31}: warning: passing 'iPadSpeckAppViewController *const __strong' to parameter of incompatible type 'id<ProductsViewControllerDelegate>' [3]
Run Code Online (Sandbox Code Playgroud)