1

好的,所以我正在关注如何设置应用程序的 Aviary 文档教程,但是我遇到了两个错误。

错误
代码如下

- (void)displayEditorForImage:(UIImage *)image
{
static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{
    [AFPhotoEditorController setAPIKey:kAFAviaryAPIKey secret:kAFAviarySecret];
});

AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:image2];

[editorController setDelegate:self]; //error is here

[self presentViewController:editorController animated:YES completion:nil];}

错误是 line [editorController setDelegate:self];,它返回上述错误,我不知道如何解决这个问题。文档中提供的示例具有相同的代码,甚至示例应用程序也具有相同的代码,但似乎工作正常。有什么我做错了吗?

4

1 回答 1

0

您需要表明您的委托类符合AFPhotoEditorControllerDelegate协议。

在您的 .m 中,通常就在该@implemenation行之前,添加一个类扩展名(您可能已经有一个)。在那里添加协议。

@interface ThirdViewController () <AFPhotoEditorControllerDelegate>

@end

@implementation ThirdViewController

// all your existing stuff

@end
于 2014-09-29T01:20:33.213 回答