在PSPoemsViewController.h我有一个协议,声明如下:IOS 6的Xcode警告协议是没有意义的
@protocol PSPoemsViewControllerDelegate <NSObject>
- (void) savePoem:(Poem *)thePoem withText:(PSTextStorage *)theText;
@end
,并在.m文件我有它的声明:
- (void) savePoem:(Poem *)thePoem withText:(PSTextStorage *)theText;
{
...
}
在PSVersionViewController。 h I类有:
@interface PSVersionViewController : UIPageViewController <PSPoemsViewControllerDelegate, UIPageViewControllerDataSource>
当我编译该编译器会引发警告:
/Users/Keith/Documents/My Projects/Poem Shed/Poem Shed/PSVersionViewController.m:28:17: Method 'savePoem:withText:' in protocol 'PSPoemsViewControllerDelegate' not implemented
事情是代码执行并找到应该丢失的方法。但是有一个奇怪的问题 - 即使没有中断设置,它有时会断开方法,然后崩溃。这暗示着某种腐败。我试过做一个干净的构建,删除方法并将其放回,但没有任何改变警告。我正在使用Xcode 6.1(它在测试版上也失败了)。
不声明在PSPoemsViewController委托方法......你只要调用它... – CW0007007 2014-10-28 13:05:12
当然该方法需要从委托调用(PSVersionViewController)并在主类(PSPoemsViewController)中声明,该类也声明协议。 – easiwriter 2014-10-28 13:12:54
你调用它,但你没有像上面那样实现它..请参阅下面的答案。 – CW0007007 2014-10-28 13:16:11