UIMenuController not working as expected, canPerformAction not getting fired

╄→尐↘猪︶ㄣ 提交于 2019-12-10 22:47:11

问题


I ran into a problem lately. The UITapgesture working on simulator perfect and even while debugging directly on the device (iPhone 4, iOS 5.0.1) but when I package the app (Dep_Target iOS4.0m Base_SDK iOS5.1(latest)) for adhoc distribution and send it to client the gestures doesn't work. I then installed the build via test flight on the same device which I am using for debugging, the gesture doesn't work on it. I rechecked everything, I am using same build for distribution. Any help will be much appreciated. Thanks

EDIT:
after doing a bit debugging it turns out that UITapgesture is not the culprit. The gesture method is getting fired but I've used a UIMenuController inside the gesture. The menu controller gets instantiated and all but not gets displayed on view. Besides the method:

- (BOOL) canPerformAction:(SEL)selector withSender:(id) sender  

is not getting fired too. Do remember this all is happening in the build which is distributed via test flight, otherwise everything runs perfect.


回答1:


I was getting this issue in one of my application and writing
[self becomeFirstResponder]
at the very first line in the function (i.e. before the line [[UIMenuController alloc] init]) solved my problem.



来源:https://stackoverflow.com/questions/10879429/uimenucontroller-not-working-as-expected-canperformaction-not-getting-fired

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!