如何找出IOS 8上导致didHideZoomSlider错误的原因? [英] How-to find out what causes a didHideZoomSlider error on IOS 8?

查看:166
本文介绍了如何找出IOS 8上导致didHideZoomSlider错误的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下错误不断出现在我的应用程序崩溃日志中

The following error keeps coming up in my app's crashlytics logs

在IOS 8上:

libobjc.A.dylib objc_msgSend + 5 didHideZoomSlider:

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000e 

我不知道从哪里开始?
任何人都知道我应该寻找什么?

I have no clue where to start? Anybody an idea on what I should be looking for?

整个堆栈跟踪:

 0
libobjc.A.dylib     
objc_msgSend + 5 
didHideZoomSlider:
1 Foundation    
__NSFireDelayedPerform + 468
2
CoreFoundation  
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
3
CoreFoundation  
__CFRunLoopDoTimer + 650
4
CoreFoundation  
__CFRunLoopRun + 1418
5
CoreFoundation  
CFRunLoopRunSpecific + 456
6
    CoreFoundation  
CFRunLoopRunInMode + 106
7
GraphicsServices    
GSEventRunModal + 136
8
UIKit   
UIApplicationMain + 1440
9
main.m line 8
main

错误消息意味着ImagePickerCameraView出了什么问题?

Does the error msg mean that something is going wrong with an ImagePickerCameraView ?

我有时会得到

 Crashed: com.apple.main-thread
 EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xeec1ff5e
 0 libobjc.A.dylib  objc_msgSend + 21 didHideZoomSlider:

如果ImagePicker是麻烦制造者,这里是代码摘录:

If ImagePicker is the troublemaker here is an code excerpt :

- (IBAction)onTakePictureToolbarButtonPushed:(id)sender {
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    [imagePicker setSourceType:
        [UIImagePickerController  isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]
            ? UIImagePickerControllerSourceTypeCamera
            : UIImagePickerControllerSourceTypePhotoLibrary
    ];

    [imagePicker setDelegate:self];
    [self presentViewController:imagePicker animated:YES completion:nil];
}



- (void)imagePickerController: (UIImagePickerController *)picker didFinishPickingMediaWithInfo: (NSDictionary *)info {
UIImage* rawImage = [info objectForKey: UIImagePickerControllerOriginalImage];

NSData *imageData = UIImageJPEGRepresentation(rawImage, 0.3);
[imageData writeToFile: @"img.jpg" atomically: YES];

[self dismissViewControllerAnimated: YES completion:nil];
[self.tableView reloadData];

}


推荐答案

我'我能够在我的代码中复制此问题。这似乎是Apple代码中的一个错误,也是一个时间问题。

I've been able to replicate this issue in my code. This seems to be a bug in Apple's code and is a timing issue.

我没有通过点击实际拍照来复制它,但我可以复制它我点击取消了。您可以尝试在代码中执行此操作,并查看它是否适合您。打开相机拍照,然后捏缩放。您将在屏幕上显示一个小缩放滑块。大约4-5秒后,变焦幻灯片逐渐消失。这就是时间进入的地方。如果你点击取消只是,因为它开始消失,你可以让它崩溃。

I haven't replicated it by clicking to actually take a photo, but I can replicate it when I hit cancel. You can try doing this in your code and seeing if it works for you. Open up the camera to take a photo and then pinch to zoom. You'll get a little zoom slider show up on the screen. After about 4-5 second that zoom slide fades away. This is where timing comes in. If you click cancel just as it starts to fade you can get it to crash.

我的假设是Apple有一个动画块,它会缩小缩放滑块。在完成该动画时,它调用 didHideZoomSlider:而不检查它对图像选择器的引用。

My assumption is that Apple has an animation block in which it fades the zoom slider. In the completion of that animation it calls didHideZoomSlider: without checking it's reference to the image picker.

我认为它更容易在我的取消代码上复制,因为它非常简单:

I think it is easier to replicate on my cancel code because it was very simple:

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    [self dismissViewControllerAnimated:YES completion:nil];
}

我的假设是,由于执行速度太快,因此可以将其解除那个动画的中间。因此,我的解决方案实际上是在很短的时间内推迟解雇视图。

My assumption is that since this executes so fast it is able to dismiss it in the middle of that animation. Therefore my solution is to actually delay my dismissal of the view by a small amount of time.

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    __weak typeof(self) wSelf = self;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [wSelf dismissViewControllerAnimated:YES completion:nil];
    });
}

我不认为这会修复这个问题,但会减少这个问题我再也无法复制它了。这应该是Apple的错误(我接下来会做)。

I don't think this "fixes" the issue, but reduces it such that I'm unable to replicate it anymore. This should be filed as a bug with Apple (which I'll do next).

更新:发送给Apple。

Update: Sent to Apple.

这篇关于如何找出IOS 8上导致didHideZoomSlider错误的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆