Привет, я получаю предупреждение о памяти, когда использую камеру.
Ошибка такая:
"Receive memory warning..."
И код:
-(void) getPhoto{
GameAppdelegate *appDelegate = (GameAppdelegate *)[[UIApplication sharedApplication]delegate];
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
///////////////////////////////////photolibrary//////////////////////////////
if([appDelegate.photoselection isEqualToString:@"User Pressed Button 1\n"])
{
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
if(appDelegate.sound == 1)
{
[classObj ButtonSound];
}
}
///////////////////////////////////Camera//////////////////////////////
else if([appDelegate.photoselection isEqualToString:@"User Pressed Button 2\n"])
{
@try
{
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
@catch (NSException * e)
{
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"ALERT"
message:@"Please try again"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"ok", nil];
[av show];
}
if(appDelegate.sound == 1)
{
[classObj ButtonSound];
}
}
///////////////////////////////////Cancel//////////////////////////////
else if([appDelegate.photoselection isEqualToString:@"User Pressed Button 3\n"])
{
if(appDelegate.sound == 1)
[classObj ButtonSound];
return;
}
[self presentModalViewController:picker animated:YES];
[picker release];
}
Как я могу справиться с этим? Пожалуйста, помогите после съемки, я обрезать изображение и сохранить в приложении, как это:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
iRolegameAppDelegate *appDelegate = (iRolegameAppDelegate *)[[UIApplication sharedApplication]delegate];
if(appDelegate.sound == 1)
{
[classObj ButtonSound];
}
[picker dismissModalViewControllerAnimated:YES];
imageView.image = image;
CGSize size = [imageView.image size];
CGRect cropRect = CGRectMake(0.0, 0.0, size.width, size.height);
NSValue *cropRectValue = [editingInfo objectForKey:@"UIImagePickerControllerCropRect"];
cropRect = [cropRectValue CGRectValue];
appDelegate.slectedimage = image;
imageView.hidden = YES;
if( [appDelegate.Name length] != 0 && max_att == 15)
{
btnNotDone.hidden = YES;
btnDone.enabled = YES;
}
//IMAGE SAVE IN DOCUMENTS//////
[UIImagePNGRepresentation(image) writeToFile:[self findUniqueSavePath] atomically:YES];
// Show the current contents of the documents folder
CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);
}
Пожалуйста, помогите мне. Я хочу удалить все предупреждения.