似乎UIActionController的呈现似乎以某种方式调用我的搜索栏文本字段textDidBeginEditing方法。最初在搜索栏已经辞职的第一响应者之后呈现控制器。这是UIActionController的预期行为吗?它是否意味着一旦被解雇后重新激活以前活动的搜索栏?
任何帮助都会很棒!
编辑:
我在搜索栏上设置了一个断点didBeginEditing方法,然后做了一个回溯试图看看谁在调用方法开始(不确定这是否是正确的方法)。这就是我得到的......这对任何想法都有帮助吗?
frame #1: 0x0000000189a9f4cc UIKit`-[UISearchBar(UISearchBarStatic) _searchFieldBeginEditing] + 84
frame #2: 0x00000001898dd398 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 96
frame #3: 0x00000001898c6474 UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 612
frame #4: 0x00000001898c5824 UIKit`-[UITextField willAttachFieldEditor:] + 764
frame #5: 0x00000001898c21c4 UIKit`-[UIFieldEditor becomeFieldEditorForView:] + 884
frame #6: 0x00000001899ab200 UIKit`-[UITextField _becomeFirstResponder] + 168
frame #7: 0x0000000189a9f300 UIKit`-[UISearchBarTextField _becomeFirstResponder] + 108
frame #8: 0x0000000189aa1f88 UIKit`-[UITextField __resumeBecomeFirstResponder] + 68
frame #9: 0x0000000189af6ad4 UIKit`__45-[UISearchBarTextField _becomeFirstResponder]_block_invoke + 316
frame #10: 0x0000000189a9f474 UIKit`-[UISearchBarTextField _becomeFirstResponder] + 480
frame #11: 0x000000018992ad28 UIKit`-[UIResponder becomeFirstResponder] + 392
frame #12: 0x000000018992b0ac UIKit`-[UIView(Hierarchy) becomeFirstResponder] + 124
frame #13: 0x00000001899a9de4 UIKit`-[UITextField becomeFirstResponder] + 68
frame #14: 0x0000000189988698 UIKit`-[UIPeripheralHost(UIKitInternal) _restoreInputViewsWithId:animated:] + 356
frame #15: 0x0000000189bcd9c8 UIKit`-[UIViewController _dismissViewControllerWithAnimationController:interactionController:completion:] + 1020
frame #16: 0x00000001899d02f8 UIKit`-[UIViewController _dismissViewControllerWithTransition:from:completion:] + 852
frame #17: 0x0000000189978388 UIKit`-[UIViewController dismissViewControllerWithTransition:completion:] + 1036
frame #18: 0x0000000189977f1c UIKit`-[UIViewController dismissViewControllerAnimated:completion:] + 252
frame #19: 0x0000000189c86f24 UIKit`-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] + 420
frame #20: 0x000000018989bf54 UIKit`_UIGestureRecognizerUpdate + 8536
frame #21: 0x0000000184de82a4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
frame #22: 0x0000000184de5230 CoreFoundation`__CFRunLoopDoObservers + 360
frame #23: 0x0000000184de5610 CoreFoundation`__CFRunLoopRun + 836
frame #24: 0x0000000184d112d4 CoreFoundation`CFRunLoopRunSpecific + 396
frame #25: 0x000000018e7676fc GraphicsServices`GSEventRunModal + 168
frame #26: 0x000000018990ef40 UIKit`UIApplicationMain + 1488
frame #27: 0x00000001000ce974 Squirrel`main(argc=1, argv=0x000000016fd539d0) + 124 at main.m:14
frame #28: 0x00000001971a6a08 libdyld.dylib`start + 4
答案 0 :(得分:0)
这解决了这个问题。 https://stackoverflow.com/a/24854803/3688923
[[NSOperationQueue mainQueue]addOperationWithBlock:^{
[self presentViewController:alert animated:YES completion:nil];
}];