Я пытаюсь выбрать фотографию из галереи устройства и установить в UIImage но авария устройства после того, как пользователя выбрать фотографию из библиотеки:ImagePicker Crash - выберите изображение из библиотеки и установить в UIImageView при использовании AutoLayout
Здесь это журнал аварии:
Notice: Formulating crash report for process [7997]
Aug 8 10:16:36 iPad ReportCrash[8000] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Aug 8 10:16:36 iPad com.apple.launchd[1]
(UIKitApplication:[0x8dd8][7997]) <Warning>:
(UIKitApplication:[0x8dd8]) Job appears to have
crashed: Trace/BPT trap: 5
Aug 8 10:16:36 iPad backboardd[26] <Warning>: Application
'UIKitApplication:[0x8dd8]' exited abnormally with signal 5: Trace/BPT
trap: 5
и вот мой код:
-(IBAction)btnSelecionarFotoClick:(id)sender {
if([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) {
inserindoFoto = YES;
UIImagePickerController *picker= [[UIImagePickerController alloc]init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:nil];
[picker release];
}
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image editingInfo:(NSDictionary *)editingInfo {
NSData *dataObj = nil;
if (image) {
dataObj = UIImageJPEGRepresentation(image, 1.0);
}
if (imgUsuario.image) {
imgUsuario.image = nil;
[imgUsuario.image release];
}
imgUsuario.contentMode = UIViewContentModeScaleAspectFill;
imgUsuario.image = image;
[imgUsuario.layer setCornerRadius:5];
imgUsuario.layer.masksToBounds = YES;
[self dismissViewControllerAnimated:NO completion:nil];
inserindoFoto = NO;
}
EDIT
, если я отменю без выбора снимка, аварии тоже:
-(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker
{
[self dismissViewControllerAnimated:NO completion:nil];
}
Я нашел проблему:
Если отключить autoLayout работает ... но мне нужно использовать autoLayout
Какое сообщение об ошибке вы получаете? – Ares
Только в xcode «Thread1: EXC_BREAKPOINT (код = EXC_ARM_BREAKPOINT, subcode = 0xdefe) и устройство регистрации сбоев –