こんにちは皆さん、画像をキャプチャしてビデオを録画するアプリケーションに取り組んでおり、アプリケーションは完全に動作しますが、このコードを使用すると
UIImageWriteToSavedPhotosAlbum(image, self,@selector(image:finishedSavingWithError:contextInfo:),nil);
私のアプリケーションは、strdup フレームの malloc 48 バイトでメモリ警告を受け取りました。
また、iOS 5.1 で Xcode 4.3.3 を使用しています。
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
if (isPhoto == YES) {
viewForAll.hidden = YES;
viewForDisplay.hidden = NO;
isPost1 = YES;
UIImage* image = [info valueForKey:@"UIImagePickerControllerOriginalImage"];
NSData* imageData = UIImageJPEGRepresentation(image,1.0);
UIImage *img1 = [[UIImage alloc] initWithData:imageData];
UIGraphicsBeginImageContext(CGSizeMake(800,1000));
[img1 drawInRect: CGRectMake(0, 0, 800, 1000)];
UIImage *smallImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
iView.hidden = NO;
iView.contentMode = UIViewContentModeScaleAspectFit;
iView.image = smallImage;
[img1 release];
}
else if (isVideo == YES) {
viewForAll.hidden = YES;
viewForDisplay.hidden = NO;
isPost1 = YES;
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
videoPath = [[info objectForKey:UIImagePickerControllerMediaURL] retain];
if ([mediaType isEqualToString:@"public.movie"]){
NSLog(@"got a movie");
NSURL *videoForURL = [info objectForKey:UIImagePickerControllerMediaURL];
videoData = [[NSMutableData dataWithContentsOfURL:videoForURL] retain];
videoName = [[videoPath lastPathComponent] retain];
}
UITextField *txtFld;
NSString *eventName;
if ([appDelegate.eventArray count] != 0) {
NSDictionary *dict = [appDelegate.eventArray objectAtIndex:0];
}
else if (isZBar == YES){
id<NSFastEnumeration> results =
[info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results)
break;
resultText = [symbol.data retain];
}
}