UIAlertController
происходит сбой с этим сообщением об ошибке:UIAlertController - Захват «контроллер» сильно в этом блоке
Попытка загрузить вид контроллера представления во время его deallocating не допускается и может привести к непредсказуемому поведению (< UIAlertController: 0x7fb9107674d0>)
также с предупреждением брошено пытается захватить TextFields objectAtIndex.
Любые идеи?
Предупреждение .. Захват «контроллера» сильно в этом блоке, вероятно, приведет к розничному циклу.
Я также попытался создать @property (weak)
ссылку предупреждение идет прочь, но приложение по-прежнему падает с этим:
-(void)viewWillAppear:(BOOL)animated
{
// self.controller = [UIAlertController alloc];
UIAlertController* controller = [UIAlertController alertControllerWithTitle:@"Add Alergy To List" message:nil preferredStyle:(UIAlertControllerStyleAlert)];
[controller addTextFieldWithConfigurationHandler:^(UITextField * nametextField) {
_nameTextField.text = [controller.textFields objectAtIndex:0].text;
}];
UIAlertAction *save = [UIAlertAction actionWithTitle:@"Save Data" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
[self save:nil];
}];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel Action" style:(UIAlertActionStyleCancel) handler:nil];
[controller addAction:save];
[controller addAction:cancel];
[self presentViewController:controller animated:YES completion:nil];
}
что это за строка '_nameTextField.text = [controller.textFields objectAtIndex: 0] .text;' на самом деле здесь, на ваш взгляд? – holex