Permalink
Browse files

disabling image picker on simulator

  • Loading branch information...
1 parent 2263ff8 commit 25685c73dbf2cf4c2ed702f5bff50430307d4ab9 @petter-petersson petter-petersson committed Dec 8, 2011
Showing with 16 additions and 15 deletions.
  1. +0 −7 Tomtelizer/XmasHatDetailsController.m
  2. +16 −8 Tomtelizer/XmasHatTakePictureController.m
@@ -33,13 +33,6 @@ - (void)didReceiveMemoryWarning
#pragma mark - View lifecycle
-/*
-// Implement loadView to create a view hierarchy programmatically, without using a nib.
-- (void)loadView
-{
-}
-*/
-
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
@@ -32,6 +32,22 @@ - (void)didReceiveMemoryWarning
- (IBAction) buttonPressed:(id)sender {
if(![browser isWorking]){
+
+ UIImagePickerController * picker = [[UIImagePickerController alloc] init];
+ picker.delegate = self;
+
+ if([UIImagePickerController isSourceTypeAvailable:(UIImagePickerControllerSourceTypeCamera)]){
+ picker.sourceType = UIImagePickerControllerSourceTypeCamera;
+ } else {
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No camera found!"
+ message:@"Image picker is not supported" /* we need camera meta data */
+ delegate:nil
+ cancelButtonTitle:@"OK"
+ otherButtonTitles:nil];
+ [alert show];
+ return;
+ }
+
takePictureButton.enabled = NO;
hatModeSegmentedCtrl.enabled = NO;
progressIndicator.hidden = NO;
@@ -47,15 +63,7 @@ - (IBAction) buttonPressed:(id)sender {
processFeatureData = NO;
break;
}
- UIImagePickerController * picker = [[UIImagePickerController alloc] init];
- picker.delegate = self;
- if([UIImagePickerController isSourceTypeAvailable:(UIImagePickerControllerSourceTypeCamera)]){
- picker.sourceType = UIImagePickerControllerSourceTypeCamera;
- } else {
- //TODO: remove this since it craches the application to not receive camera meta data
- picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
- }
[self presentModalViewController:picker animated:YES];
} else {
NSLog(@"browser is working - ignoring buttonPressed...");

0 comments on commit 25685c7

Please sign in to comment.