gpt4 book ai didi

ios - 'NSInvalidArgumentException',原因 : '-[UIView isAnimating]: unrecognized selector sent to instance

转载 作者:行者123 更新时间:2023-11-29 03:41:06 24 4
gpt4 key购买 nike

xcode 和 objective-c 的新手。所以请原谅我的菜鸟错误,但我已经遇到这个错误“'NSInvalidArgumentException',原因:'-[UIView isAnimating]:无法识别的选择器发送到实例”已经一天多了,并且已经做了很多搜索但没有成功。当我清理/构建应用程序时没有错误,但是当我单击按钮加载“UIIMagePickerController”时,应用程序终止并引发错误。请帮忙。谢谢

- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{
if (self.imageView.isAnimating)
{
[self.imageView stopAnimating];
}

if (self.capturedImages.count > 0)
{
[self.capturedImages removeAllObjects];
}

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;

if (sourceType == UIImagePickerControllerSourceTypeCamera)
{
imagePickerController.showsCameraControls = NO;

[[NSBundle mainBundle] loadNibNamed:@"OverlayView" owner:self options:nil];
self.overlayView.frame = imagePickerController.cameraOverlayView.frame;
imagePickerController.cameraOverlayView = self.overlayView;
self.overlayView = nil;
}

self.imagePickerController = imagePickerController;
[self presentViewController:self.imagePickerController animated:YES completion:nil];

最佳答案

您的代码self.imageView.isAnimating正在被编译器转换为[类似于]:

[[self imageView] isAnimating]

根据错误消息,[self imageView] 返回一个 UIView 对象。 UIView 类上没有方法 isAnimating,因此会出现异常。

找出[self imageView]的设置位置,也许它在那里做错了什么?另外,你有没有开启ARC?这可能是一个内存管理错误。

关于ios - 'NSInvalidArgumentException',原因 : '-[UIView isAnimating]: unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18434360/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com