在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