1 Answers1

2

I assume that clicking that "done" button would invoke cancelling the picker; in which case you can try did you try implementing the delegate method:

 - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
      [self dismissViewControllerAnimated:YES completion:^(void) {
           NSLog(@"Cancelled pick");
      };
 }

Also it looks like you're calling release -- any reason you're not using ARC?

If I had to guess, I'd say perhaps the alert dismiss is in fact calling something like

 [imagePicker.delegate imagePickerControllerDidCancel:imagePicker];

but it's already released so you're seeing this "lock-up" issue. Maybe step through in the debugger and make sure those objects still exist.

Edit:

While it doesn't solve your original issue, you could do a check for available space prior to launching the image picker, possibly with something like this so post suggests:

- (uint64_t)freeDiskspace
 {
     uint64_t totalSpace = 0;
     uint64_t totalFreeSpace = 0;

     __autoreleasing NSError *error = nil;  
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);  
     NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];  

     if (dictionary) {  
         NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];  
         NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
         totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
         totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
         NSLog(@"Memory Capacity of %llu MiB with %llu MiB Free memory available.", ((totalSpace/1024ll)/1024ll), ((totalFreeSpace/1024ll)/1024ll));
     } else {  
         NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %d", [error domain], [error code]);  
     }    

     return totalFreeSpace;
 }
Community
  • 1
  • 1
Miles Alden
  • 1,554
  • 1
  • 11
  • 21
  • I already have that delegate method implemented. Clicking the done button doesn't call that delegate method.Its old app i have been working on never really made the switch to ARC – user1861763 Jan 14 '13 at 19:40
  • Did stepping through reveal any nil objects being accessed? – Miles Alden Jan 14 '13 at 20:06
  • I don't think its a memory management issue and i don't see any nil objects being accessed. – user1861763 Jan 14 '13 at 20:28
  • I was actually just looking into calculating the available disk space.Thank you for your help – user1861763 Jan 14 '13 at 20:29
  • Sure. I still find it odd though that I can't find any docs detailing how the system handles this situation. You'd think they'd document it *somewhere*. Oh well. :-) – Miles Alden Jan 14 '13 at 20:32