1
我一直在iPhone 4S和iPhone5上開發我的項目。在我的項目中,照片拍攝後,我裁剪它,然後調整圖像大小以應用照片濾鏡。 iPhone 5似乎在iPhone 4S上處理得非常好,但在拍照過程中它似乎在不同的地方出現故障。我檢查了是否有任何內存泄漏,我可能錯過了。這是下面的代碼:iPhone 4S無法處理來自AVCaptureSessionPresetPhoto的全分辨率
[stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error)
{
[captureSession stopRunning];
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
UIImage *newImage = [[UIImage alloc] initWithData:imageData];
在此之後,我自動檢測拍攝的照片的方向和旋轉圖片,以便它總是直立。
在此之後,我裁剪圖像到使用NYXImagesKit
float filteringSquareRatio = 307.0/320.0;
UIImage *cropped = [newImage cropToSize:CGSizeMake(filteringSquareRatio * newImage.size.width, filteringSquareRatio * newImage.size.width) usingMode:NYXCropModeCenter];
最後一平方,我調整使用圖像MGImageUtilities
UIImage *resized = [cropped imageScaledToFitSize:CGSizeMake(320, 320)];
有沒有更好的方式來做到這一點?我目前正在使用AVCaptureSessionPresetPhoto,因爲我想將原始高分辨率照片保存在設備上,並將裁剪後的尺寸和版本發送到服務器。我不想使用任何視頻預設,因爲相機放大。什麼可能導致崩潰?