You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ipad causing *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to find Picker view's window. This may cause a memory leak.'
#581
Open
Michael-Lumpp opened this issue
Sep 18, 2024
· 3 comments
Hi all, @skywinder@Wei18
This works perfectly fine for iPhone, even latest Swift5, however trying now on latest iPad, I get this error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to find Picker view's window. This may cause a memory leak.'
It seems to be hitting this block:
- (void)addTapDismissAction {
if (!self.pickerView) {
NSAssert(_pickerView != NULL, @"Picker view failed to instantiate, perhaps you have invalid component data.");
return;
}
if (self.windowTapActionRetryCount > 10) {
NSAssert(NO, @"Failed to find Picker view's window. This may cause a memory leak.");
}
if (!self.pickerView.window) {
self.windowTapActionRetryCount += 1;
dispatch_async(dispatch_get_main_queue(), ^{
[self addTapDismissAction];
});
return;
}
I am calling the code like such:
self.workplacePicker = ActionSheetStringPicker(title: "", rows: workplaces, initialSelection: workplaceSelectedIndex,
doneBlock: {
picker, index, value in
//my code here
self.Refresh()
},
cancel: { ActionSheetCancelBlock in
self.workplacePicker?.dismiss()
},
origin: lblJob)
let btnCancel = UIBarButtonItem(title: Localized("Cancel"), style: UIBarButtonItem.Style.plain, target: self, action: nil)
let btnEdit = UIBarButtonItem(title: Localized("Edit"), style: UIBarButtonItem.Style.plain, target: self, action: #selector(JobSettingsViewController.btnEditWorkplace(_:)))
let btnAddNew = UIBarButtonItem(title: Localized("AddNew"), style: UIBarButtonItem.Style.plain, target: self, action: #selector(JobSettingsViewController.btnAddWorkplace(_:)))
let btnSelect = UIBarButtonItem(title: Localized("Select"), style: UIBarButtonItem.Style.plain, target: self, action: nil)
workplacePicker!.setCancelButton(btnCancel)
workplacePicker!.setDoneButton(btnSelect)
// Ensure the view is fully laid out
self.view.setNeedsLayout()
self.view.layoutIfNeeded()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
guard let picker = self.workplacePicker else { return }
picker.show()
btnCancel.width = picker.toolbar.frame.width / 5
btnEdit.width = picker.toolbar.frame.width / 6
btnAddNew.width = picker.toolbar.frame.width / 6
btnSelect.width = picker.toolbar.frame.width / 6
picker.toolbar.items?.insert(btnEdit, at: 1)
picker.toolbar.items?.insert(btnAddNew, at: 2)
}
Any ideas or support? thank you so much
The text was updated successfully, but these errors were encountered:
Hi all,
@skywinder @Wei18
This works perfectly fine for iPhone, even latest Swift5, however trying now on latest iPad, I get this error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to find Picker view's window. This may cause a memory leak.'
It seems to be hitting this block:
I am calling the code like such:
Any ideas or support? thank you so much
The text was updated successfully, but these errors were encountered: