iPhone のカメラからスナップを取得しているときに問題が発生し、デバイス コンソールに「受信メモリ警告」というエラーが表示されます。iPhoneフォトライブラリからスナップを選択している間、メモリ警告の問題は発生しません。これは以下のコードです
-(IBAction)uploadImageBtn:(id)sender
{
UIButton *btn = (UIButton *)sender;
@try
{
UIImagePickerController *pickImage = [[UIImagePickerController alloc]init];
pickImage.delegate = (id)self;
if (btn.tag == 2)
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary ])
{
pickImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:pickImage animated:YES completion:nil];
}
else
{
UIAlertView *alertVw = [[UIAlertView alloc]initWithTitle:@"Message" message:@"Photo library not exist" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alertVw show];
}
}
else if (btn.tag == 3)
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera ])
{
pickImage.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:pickImage animated:YES completion:nil];
}
else
{
UIAlertView *alertVw = [[UIAlertView alloc]initWithTitle:@"Message" message:@"Camera not working " delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alertVw show];
}
}
}
@catch (NSException *exception)
{
NSLog(@"exception %@",exception);
}
}
// uiimage picker view controller delegate method
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
@try {
[picker dismissViewControllerAnimated:YES completion:nil];
// Edited image works great (if you allowed editing)
myImage = [info objectForKey:UIImagePickerControllerEditedImage];
// AND the original image works great
myImage = [info objectForKey:UIImagePickerControllerOriginalImage];
myImage = [myImage fixOrientation];
// AND do whatever you want with it, (NSDictionary *)info is fine now
// fixOrObj = [[fixorientation alloc]init];
// myImage = [fixOrObj fixOrientation];
dataObj = UIImageJPEGRepresentation(myImage, 0);
HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.delegate = (id)self;
HUD.labelText = @"Uploading image";
[self performSelector:@selector(uploadimages) withObject:nil afterDelay:1.0];
}
@catch (NSException *exception)
{
NSLog(@"exception %@",exception);
}
}
この問題を親切に解決してください。2日間試してみましたが、成功しませんでした