2011-12-31 10 views
0

私はUIImagePickerControllerデリゲート、UINavigationControllerデリゲート、UIPopOverControllerデリゲートを実装しています。私は問題が何かを知りません。このデバイスを3、4、または5回呼び出すと、デバイスが再起動します(各ビルドごとに異なります)。私がそれを解決するのを手伝ってください!UIImagePickerControllerを複数回呼び出すと、デバイスが再起動します

編集:私はこのエラーを取得する:ここで

More than maximum 5 filtered album lists trying to register. This will fail. 

は、私がUIImagePickerControllerを呼び出して画像を取得するために使用していたコードです:

- (IBAction)imgPickerPressed:(id)sender { 
    if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { 
     imgPickerTypeActionSheet = [[UIActionSheet alloc] initWithTitle:@"Choose image source:" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Camera", @"Photo Library", nil]; 
     [imgPickerTypeActionSheet showInView:self]; 
    } 
    else { 
     UIImagePickerController *controller = [[UIImagePickerController alloc] init]; 
     [controller setDelegate:self]; 
     if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { 
      [controller setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; 
     } 
     imgPickerPopOver = [[UIPopoverController alloc] initWithContentViewController:controller]; 
     imgPickerPopOver.delegate = self; 
     [imgPickerPopOver presentPopoverFromRect:CGRectMake(imgPickerButton.frame.origin.x, imgPickerButton.frame.origin.x-250, 0.0, 0.0) 
              inView:self 
         permittedArrowDirections:UIPopoverArrowDirectionDown 
             animated:YES]; 
    } 
} 
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { 
    if ([actionSheet isEqual:imgPickerTypeActionSheet]) { 
     if (buttonIndex == 0) { 
      UIImagePickerController *controller = [[UIImagePickerController alloc] init]; 
      [controller setDelegate:self]; 
      [controller setSourceType:UIImagePickerControllerSourceTypeCamera]; 

      [[delegate getVC] presentModalViewController:controller animated:YES]; 
     } 
     if (buttonIndex == 1) { 
      UIImagePickerController *controller = [[UIImagePickerController alloc] init]; 
      [controller setDelegate:self]; 
      [controller setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; 

      imgPickerPopOver = [[UIPopoverController alloc] initWithContentViewController:controller]; 
      imgPickerPopOver.delegate = self; 
      [imgPickerPopOver presentPopoverFromRect:CGRectMake(imgPickerButton.frame.origin.x, imgPickerButton.frame.origin.x-250, 1, 1) 
               inView:self 
          permittedArrowDirections:UIPopoverArrowDirectionDown 
              animated:YES]; 
     } 
    } 
} 
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { 
    [imgPickerPopOver dismissPopoverAnimated:YES]; 
    pickedImageView.image = image; 
    [self valueChanged:nil]; 
} 
+0

デバイスを再起動するとどういう意味ですか?つまり、電源が切れ、自動的にスイッチが入ります。 –

+0

デバイスが再起動します。実際のデバイスが再起動し、デバイスがオフになり、再びオンに戻ります。 – Aspyn

+0

エラーが見つかりましたが、修正が分からない – Aspyn

答えて

0

は、iOSシミュレーターでこの仕事をしていますか?また、これらのオブジェクトのいずれかをリリースしていますか、またはARCはそれをやっていますか? Thisが役に立ちます。

+0

ARCはそれをやっていますシミュレータで – Aspyn

関連する問題