ImagePickerTrayController
ImagePickerTrayController copied to clipboard
PHCachingImageManager and photo library being denied
So, it's safer to set imageManager below as an optional, fileprivate let imageManager = PHCachingImageManager()
and only assign it after we check for Photo library access status. I have seen some crashes (might be in iOS9 only) when that isn't done, and the user hasn't determined the status yet; imageManager is initialized correctly, but if the user denies access, it might cause a crash.