Swift错误libc ++ abi.dylib:以NSException(lldb)类型的未捕获异常终止

时间:2017-01-04 18:48:38

标签: ios swift xcode

我是Swift的新手,我需要你的帮助。

    lazy var profileImageView: UIImageView = {
    let imageView = UIImageView()
    imageView.image = UIImage(named: "Userprofile")
    imageView.translatesAutoresizingMaskIntoConstraints = false
    imageView.contentMode = .scaleAspectFill

    var tap = UITapGestureRecognizer(target: self, action: Selector(("handleSelectProfileImageView")))
    imageView.addGestureRecognizer(tap)
    imageView.isUserInteractionEnabled = true

    return imageView
}()

func handleSelectProfileImageView() {
        let picker = UIImagePickerController()
        picker .delegate = self
        picker.sourceType = UIImagePickerControllerSourceType.photoLibrary
        self.present(picker, animated: true)
    }

    func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
        if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
            profileImageView.image = image
        }else
        {
            //ERROR
        }
        self.dismiss(animated: true, completion: nil)
    }

    func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
        print("canceled picker")
        dismiss(animated: true, completion: nil)
    }

}

然后我收到了这个错误:

  

017-01-04 19:39:18.889 ChatUp [7484:136643] *由于未捕获的异常终止应用' NSInvalidArgumentException',原因:' - [ChatUp.LoginController handleSelectProfileImageView ]:无法识别的选择器发送到实例0x7fe94cc0c0c0'   * 第一次抛出调用堆栈:   (       0 CoreFoundation 0x000000010a41ad4b exceptionPreprocess + 171       1 libobjc.A.dylib 0x0000000109e7c21e objc_exception_throw + 48       2 CoreFoundation 0x000000010a48af04 - [NSObject(NSObject)doesNotRecognizeSelector:] + 132       3 CoreFoundation 0x000000010a3a0005 ___转发_ + 1013       4 CoreFoundation 0x000000010a39fb88 _CF_forwarding_prep_0 + 120       5 UIKit 0x000000010b48d409 - [UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57       6 UIKit 0x000000010b4951a8 _UIGestureRecognizerSendTargetActions + 109       7 UIKit 0x000000010b492c77 _UIGestureRecognizerSendActions + 227       8 UIKit 0x000000010b491f03 - [UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 891       9 UIKit 0x000000010b47df7e _UIGestureEnvironmentUpdate + 1395       10 UIKit 0x000000010b47d9c3 - [UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 521       11 UIKit 0x000000010b47cba6 - [UIGestureEnvironment _updateGesturesForEvent:window:] + 286       12 UIKit 0x000000010afc2c1d - [UIWindow sendEvent:] + 3989       13 UIKit 0x000000010af6f9ab - [UIApplication sendEvent:] + 371       14 UIKit 0x000000010b75c72d dispatchPreprocessedEventFromEventQueue + 3248       15 UIKit 0x000000010b755463 __handleEventQueue + 4879       16 CoreFoundation 0x000000010a3bf761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17       17 CoreFoundation 0x000000010a3a498c __CFRunLoopDoSources0 + 556       18 CoreFoundation 0x000000010a3a3e76 __CFRunLoopRun + 918       19 CoreFoundation 0x000000010a3a3884 CFRunLoopRunSpecific + 420       20 GraphicsServices 0x000000010e329a6f GSEventRunModal + 161       21 UIKit 0x000000010af51c68 UIApplicationMain + 159       22 ChatUp 0x000000010845d42f main + 111       23 libdyld.dylib 0x000000010d1c368d start + 1       24 ??? 0x0000000000000001 0x0 + 1   )   libc ++ abi.dylib:以NSException类型的未捕获异常终止   (lldb)

0 个答案:

没有答案