AVFoundation die Ausrichtung der Bilder aus um 90 Grad in der Vorschau, aber fein in der Kamera roll

Wirklich etwas seltsam, ist passiert, ich bin versucht, ein Bild mit AVFoundation, die Kamera roll, Bild scheint ganz gut, aber das Bild als Vorschau, hat das Bild um 90 Grad gedreht.

Dies ist der code, den ich benutze, um ein Bild aufzunehmen

AVCaptureConnection *videoConnection = nil;
for (AVCaptureConnection *connection in stillImageOutput.connections)
{
    for (AVCaptureInputPort *port in [connection inputPorts])
    {
        if ([[port mediaType] isEqual:AVMediaTypeVideo] )
        {
            videoConnection = connection;
            break;
        }
    }
    if (videoConnection)
    {
        break;
    }
}

//NSLog(@"about to request a capture from: %@", stillImageOutput);
[stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error)
 {
     CFDictionaryRef exifAttachments = CMGetAttachment( imageSampleBuffer, kCGImagePropertyExifDictionary, NULL);
     if (exifAttachments)
     {
         //Do something with the attachments.
         //NSLog(@"attachements: %@", exifAttachments);
     } else {
         NSLog(@"no attachments");
     }

     NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];

     UIImage *image = [[UIImage alloc] initWithData:imageData];

     self.vImage.image = image;

     UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
 }];
  • Warum hat die bekommst auch ein vote down by the way? ist die Lösung trivial ist? wenn es ist, bitte erleuchte mich! Dies ist ein Ort, um zu lernen, nicht gemieden werden. Ich versuche mein bestes, zu lernen, wie hätten Sie an einem gewissen Punkt der Zeit!
  • Haben dieses Album, was richtig funktioniert, wenn ja dann bitte teilen Sie diese mit uns
InformationsquelleAutor Jonathan | 2013-04-11
Schreibe einen Kommentar