Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It crashes on Xcode8 & Swift 3.0. #135

Open
showmylym opened this issue Sep 21, 2016 · 1 comment
Open

It crashes on Xcode8 & Swift 3.0. #135

showmylym opened this issue Sep 21, 2016 · 1 comment

Comments

@showmylym
Copy link

showmylym commented Sep 21, 2016

The crash position stopped at @UIApplicationMain, and printed following log in console.

invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
libc++abi.dylib: terminate_handler unexpectedly threw an exception

Present code is

                        let imagePicker = ELCImagePickerController(imagePicker: ())
                        imagePicker?.mediaTypes = [ALAssetTypePhoto]
                        imagePicker?.onOrder = true
                        imagePicker?.maximumImagesCount = canSelectPhotoNum
                        imagePicker?.imagePickerDelegate = self
                        imagePicker?.navigationBar.barTintColor = ColorMainTheme
                        imagePicker?.navigationBar.tintColor = UIColor.white
                        imagePicker?.navigationBar.titleTextAttributes = [NSFontAttributeName: self.titleLabel.font, NSForegroundColorAttributeName: imagePicker?.navigationBar.tintColor]
                        imagePicker?.navigationItem.title = StrPhoto
                        self.present(imagePicker!, animated: true, completion: nil)

@showmylym
Copy link
Author

Oh, I got it. The reason of crash is that
imagePicker?.navigationBar.titleTextAttributes = [NSFontAttributeName: self.titleLabel.font, NSForegroundColorAttributeName: imagePicker?.navigationBar.tintColor]
type of titleTextAttributes is [String: Any]?,so that self.titleLabel.font and imagePicker?.navigationBar.tintColor can't be optional type. It won't be crash if force unwrap optional value before use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant