6

这是一个非常愚蠢的堆栈跟踪,因为环顾四周,我唯一能想到的是 iPhone 6s 用户正在尝试 3D 触摸某些东西,以及我的手势识别器(某处,我不知道是哪个,因为它没有'不告诉我哪条线甚至哪个控制器)不知道如何处理它?我没有添加任何 3D 触摸手势识别器,也没有在任何地方实现 3D 触摸交互。

我在这个版本中以 iOS 8 为目标,不幸的是我没有 iPhone 6s 可以测试,所以无法真正重现它。

关于可能导致它的原因,如何缩小重现的位置/内容以及如何重现以及如何处理异常的想法?

Thread : Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x18586cf48 __exceptionPreprocess
1  libobjc.A.dylib                0x19ad17f80 objc_exception_throw
2  CoreFoundation                 0x185873b54 __CFExceptionProem
3  UIKit                          0x18b63438c -[UICollectionViewController previewingContext:viewControllerForLocation:]
4  UIKit                          0x18b187d7c -[_UIViewControllerPreviewSourceViewRecord previewInteractionController:viewControllerForPreviewingAtPosition:inView:presentingViewController:]
5  UIKit                          0x18b43cd4c -[UIPreviewInteractionController startInteractivePreviewAtLocation:inView:]
6  UIKit                          0x18b43d848 -[UIPreviewInteractionController startInteractivePreviewWithGestureRecognizer:]
7  UIKit                          0x18b43e8c0 -[UIPreviewInteractionController _handleRevealGesture:]
8  UIKit                          0x18b37b330 _UIGestureRecognizerSendTargetActions
9  UIKit                          0x18afa4b5c _UIGestureRecognizerSendActions
10 UIKit                          0x18ae3285c -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:]
11 UIKit                          0x18b37c70c ___UIGestureRecognizerUpdate_block_invoke898
12 UIKit                          0x18adf18b8 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks
13 UIKit                          0x18adee63c _UIGestureRecognizerUpdate
14 UIKit                          0x18ae306cc -[UIWindow _sendGesturesForEvent:]
15 UIKit                          0x18ae2fcc8 -[UIWindow sendEvent:]
16 UIKit                          0x18ae004a4 -[UIApplication sendEvent:]
17 UIKit                          0x18adfe76c _UIApplicationHandleEventQueue
18 CoreFoundation                 0x185824544 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
19 CoreFoundation                 0x185823fd8 __CFRunLoopDoSources0
20 CoreFoundation                 0x185821cd8 __CFRunLoopRun
21 CoreFoundation                 0x185750ca0 CFRunLoopRunSpecific
22 GraphicsServices               0x190cd4088 GSEventRunModal
23 UIKit                          0x18ae68ffc UIApplicationMain
24 XXXXXXXXXX                     0x10013739c main (main.m:16)
25 libdyld.dylib                  0x19b55a8b8 start
4

3 回答 3

6

PUPhotoGridViewController(在 UIImagePickerController 中使用)是一个简单的 UICollectionViewController,你可以为未实现的方法编写扩展。

extension UICollectionViewController: UIViewControllerPreviewingDelegate {
    public func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
        return nil;
    }

    public func previewingContext(previewingContext: UIViewControllerPreviewing, commitViewController viewControllerToCommit: UIViewController) {

    }
}
于 2015-12-24T12:27:12.927 回答
5

UIImagePickerController在你的应用程序的某个地方使用吗?它和 3D Touch 存在一个已知问题:UIImagePickerController 在强制触摸时崩溃?

强制触摸照片UIImagePickerController似乎会使任何应用程序崩溃。我想我们必须等到苹果解决这个问题。

于 2015-12-19T10:20:26.237 回答
3

感谢@Antigp'answer

这是OC版本:

标题

@interface UICollectionViewController (FixCrash) <UIViewControllerPreviewingDelegate>
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location;
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext
     commitViewController:(UIViewController *)viewControllerToCommit;
@end

执行

@implementation UICollectionViewController (FixCrash)
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location {
    return nil;
}
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext
         commitViewController:(UIViewController *)viewControllerToCommit {
    return;
}
@end
于 2016-01-20T12:21:07.860 回答