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 8 SDK: modal UIWebView and camera/image picker

I found that in iOS 8.0.2 iPad does not seem to have that bug but iPhone still does. However, overriding following in the view controller containing the uiwebview -(void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion And checking that there is a presentedViewController seems to work. But need to check side effects #import “UiWebViewVC.h” @interface UiWebViewVC () @property (weak, nonatomic) … Read more

How can i get the name of image picked through photo library in iphone?

import AssetsLibrary in your file: #import <AssetsLibrary/AssetsLibrary.h> And, in – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info put // get the ref url NSURL *refURL = [info valueForKey:UIImagePickerControllerReferenceURL]; // define the block to call when we get the asset based on the url (below) ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *imageAsset) { ALAssetRepresentation *imageRep = [imageAsset defaultRepresentation]; NSLog(@”[imageRep filename] : … Read more

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

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

tech