2

大家好,我正在开发一个应用程序,在该应用程序中,我正在捕获图像并录制视频,并且我的应用程序运行良好,但是当我使用此代码时

UIImageWriteToSavedPhotosAlbum(image, self,@selector(image:finishedSavingWithError:contextInfo:),nil);

我的应用程序在 strdup 帧中的 malloc 48 字节中收到内存警告。

我正在使用 Xcode 4.3.3 和 iOS 5.1。

- (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];      

    }
}
4

0 回答 0