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

<pre><code>present(picker, animated: true, completion: nil)
</code></pre>

<p>in the function:</p>

<pre><code>@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) // -&gt; 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)
}
</code></pre>

<p>The crash message in the console:</p>

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

<p>in my in info.plist I have:</p>

<pre><code>&lt;key&gt;NSPhotoLibraryUsageDescription&lt;/key&gt;
&lt;string&gt;$(PRODUCT_NAME) photo gallery use&lt;/string&gt;
&lt;key&gt;NSCameraUsageDescription&lt;/key&gt;
&lt;string&gt;$(PRODUCT_NAME) camera use &lt;/string&gt;
&lt;key&gt;NSMicrophoneUsageDescription&lt;/key&gt;
&lt;string&gt;$(PRODUCT_NAME) microphone use&lt;/string&gt;
</code></pre>

<p>I looked around and did see that having NSPhotoLibraryUsageDescription and  NSCameraUsageDescription in info.plist solves the issue (<a href="https://stackoverflow.com/questions/39428916/uiimagepickercontroller-in-swift-3">UIImagePickerController in Swift 3</a> and <a href="https://stackoverflow.com/questions/37925583/uiimagepickercontroller-crashes-app-swift3-xcode8">UIImagePickerController crashes app | Swift3, Xcode8</a>), but it doesn't for me. I did clean and build, restarted xCode, restarted Mac, etc. </p>

<p>It might be worth pointing out that my console at startup says:</p>

<pre><code>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. 
</code></pre>

<p>but according to this thread that doesn't matter <a href="https://forums.developer.apple.com/thread/63254" rel="nofollow noreferrer">https://forums.developer.apple.com/thread/63254</a> </p>

<p>my class has the delegates:</p>

<pre><code>class PersonalSettingsVC: UIViewController, UITextFieldDelegate, UITextViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate 
</code></pre>

<p>Any help is much appreciated</p>