Peter de Vries from

I upgraded project to Swift 3 and I am getting a crash on the line (at various points/viewControllers in the project) :

present(picker, animated: true, completion: nil)

in the function:

@IBAction func userImage(_ sender: AnyObject){
    print("button pressed")
    let picker = UIImagePickerController()
    picker.delegate = self
    picker.allowsEditing = false
    picker.sourceType = .photoLibrary
    present(picker, animated: true, completion: nil) // -> crashes here
}

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
    let image = info[UIImagePickerControllerOriginalImage] as! UIImage
    self.imageToPost.setImage(newImage, for: UIControlState())
    self.imageToPost.imageView?.contentMode = UIViewContentMode.scaleAspectFill
    picker.dismiss(animated: true, completion: nil)
}

The crash message in the console:

libsystem_kernel.dylib`__abort_with_payload:
0x11108d138 <+0>:  movl   $0x2000209, %eax          ; imm = 0x2000209 
0x11108d13d <+5>:  movq   %rcx, %r10
0x11108d140 <+8>:  syscall 
->  0x11108d142 <+10>: jae    0x11108d14c               ; <+20>
0x11108d144 <+12>: movq   %rax, %rdi
0x11108d147 <+15>: jmp    0x111086d6f               ; cerror_nocancel
0x11108d14c <+20>: retq   
0x11108d14d <+21>: nop    
0x11108d14e <+22>: nop    
0x11108d14f <+23>: nop    

in my in info.plist I have:

<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) photo gallery use</string>
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera use </string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) microphone use</string>

I looked around and did see that having NSPhotoLibraryUsageDescription and NSCameraUsageDescription in info.plist solves the issue (UIImagePickerController in Swift 3 and UIImagePickerController crashes app | Swift3, Xcode8), but it doesn't for me. I did clean and build, restarted xCode, restarted Mac, etc.

It might be worth pointing out that my console at startup says:

objc[11204]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x11a0d8910) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x119f02210). One of the two will be used. Which one is undefined. 

but according to this thread that doesn't matter https://forums.developer.apple.com/thread/63254

my class has the delegates:

class PersonalSettingsVC: UIViewController, UITextFieldDelegate, UITextViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate 

Any help is much appreciated

answered 6 months ago NOVA Legacy Cheats #

In fаct no matter if sⲟmeeone doеsn't understand after that itѕ up to other people that they will help, so here it happens.


Leave a answer: