0

編集-私はこれを自分で解決しました-下部のメモを参照してください

Xcode 5 で iOS7 を使用している場合、カメラまたはフォト ライブラリから画像を取得するオプションを使用しています。

これは iOS7 を実行している iPhone では発生せず、iPad では問題なく動作しますが、方法は少し異なりますが、iOS7 では iPhone のみの問題のようです。

たとえば、ライブラリ関数から画像を選択する際に使用されるコードは次のとおりです。

-(void) choosePic {
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]) {
        UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
        cameraUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeSavedPhotosAlbum];
        cameraUI.allowsEditing = NO;
        cameraUI.delegate = self;

        if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        {
            _popover = [[UIPopoverController alloc] initWithContentViewController:cameraUI];
            [_popover presentPopoverFromRect:btnLibrary.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];


        }
        else

            [self presentModalViewController: cameraUI animated: YES];

    }    
}

また、ピッカーが終了したらコード。

- (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info { 
    //Disable buttons

    [[UIApplication sharedApplication] setStatusBarHidden:YES];

    [self disableButtons];

    //Get image
    self.originalImage = (UIImage *) [info objectForKey: UIImagePickerControllerOriginalImage];

    //Dismiss
    if(_popover)
    {
        if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        {
            [_popover dismissPopoverAnimated:YES];
            _popover = nil;
        }
    }
    else
        [picker dismissModalViewControllerAnimated: YES];

    //Next
    [self performSelector: @selector(nextScreen) withObject:nil afterDelay:0.5];
}

切り替えることでこれを修正しました。

[picker dismissModalViewControllerAnimated: YES];

[picker dismissViewControllerAnimated:NO completion:nil];
4

1 に答える 1

0

最初に、ロジックが意図した正しい場所に到達することを確認する必要があります。iPhone の特定の行の前にブレークポイントまたは NSLog を設定してみてください。

-(void) choosePic {
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]) {
        UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
        cameraUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeSavedPhotosAlbum];
        cameraUI.allowsEditing = NO;
        cameraUI.delegate = self;

        if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        {
            _popover = [[UIPopoverController alloc] initWithContentViewController:cameraUI];
            [_popover presentPopoverFromRect:btnLibrary.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];


        }else{
            NSLog(@"Checkpoint !");
            [self presentModalViewController: cameraUI animated: YES];
        }

    }     }
于 2013-09-22T17:10:39.623 に答える