如何解决语义问题

时间:2013-11-15 23:15:23

标签: ios objective-c

我正在尝试修复我的应用中的一个问题,导致它在iPhone 5s上崩溃。

问题来自这行代码

 imagePicker.delegate = self;

警告准确读取此内容

“从不兼容的类型'ShowcaseFilterListController * const_strong'

分配给'id'

这是整个图像选择器方法

-(IBAction)segmentAction:(id)sender

{

segmentedControl = (UISegmentedControl *)sender;
if (segmentedControl.selectedSegmentIndex == 0)
{
    isStatic = NO;

}
else if (segmentedControl.selectedSegmentIndex == 1)
{

    isStatic = YES;

    imagePicker = [[UIImagePickerController alloc]init];
    UIImagePickerControllerSourceType   soureType;

    soureType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePicker.delegate = self;
    imagePicker.allowsEditing = NO;
    imagePicker.sourceType = soureType;

}

}

我正在使用GPUImage并且还在学习,该应用程序除了这一个问题外还能正常工作。如果这是一个小小或愚蠢的错误,我道歉:)

谢谢大家

1 个答案:

答案 0 :(得分:0)

这里只是扩展评论......你必须确保你的类符合UIImagePickerControllerDelegate和UINavigationControllerDelegate才能使其正常工作。你的@interface应该是这样的:

@interface ShowcaseFilterListController () < UINavigationControllerDelegate , UIImagePickerControllerDelegate >

然后,如果您查看UIImagePickerControllerDelegate class reference,您将找到有关您希望实施的委托方法的信息。

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker