UIImagePickerController error: Snapshotting a view that has not been rendered results in an empty snapshot in iOS 7

The problem in iOS7 has to do with transitions. It seems that if a previous transition didn’t complete and you launch a new one, iOS7 messes the views, where iOS6 seems to manage it correctly. You should initialize your Camera in your UIViewController, only after the view has Loaded and with a timeout: – (void)viewDidAppear:(BOOL)animated … Read more

How to allow user to pick the image with Swift?

If you just want let the user choose image with UIImagePickerController use this code: import UIKit class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate { @IBOutlet var imageView: UIImageView! @IBOutlet var chooseBuuton: UIButton! var imagePicker = UIImagePickerController() @IBAction func btnClicked() { if UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum){ print(“Button capture”) imagePicker.delegate = self imagePicker.sourceType = .savedPhotosAlbum imagePicker.allowsEditing = false present(imagePicker, animated: true, completion: … Read more

Detect permission of camera in iOS

Check the AVAuthorizationStatus and handle the cases properly. NSString *mediaType = AVMediaTypeVideo; AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType]; if(authStatus == AVAuthorizationStatusAuthorized) { // do your logic } else if(authStatus == AVAuthorizationStatusDenied){ // denied } else if(authStatus == AVAuthorizationStatusRestricted){ // restricted, normally won’t happen } else if(authStatus == AVAuthorizationStatusNotDetermined){ // not determined?! [AVCaptureDevice requestAccessForMediaType:mediaType completionHandler:^(BOOL granted) { … Read more

iOS 8 Snapshotting a view that has not been rendered results in an empty snapshot

I’m pretty sure this is just a bug in iOS 8.0. It’s reproducible with the simplest of POC apps that does nothing more than attempt to present a UIImagePickerController like you’re doing above. Furthermore, there’s no alternative pattern to displaying the image picker/camera, to my knowledge. You can even download Apple’s Using UIImagePickerController sample app, … Read more

iOS UIImagePickerController result image orientation after upload

A UIImage has a property imageOrientation, which instructs the UIImageView and other UIImage consumers to rotate the raw image data. There’s a good chance that this flag is being saved to the exif data in the uploaded jpeg image, but the program you use to view it is not honoring that flag. To rotate the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)