Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIWebView and define dictionary

I had the copy and define option built in with the UIWebView. It worked just fine on the iPad but on the iPhone, it only works once when I highlight the text and use the dictionary and the second time I tried it, it doesn't show up the popover. Any idea?

UPDATE: I am getting the following error as well when dismissing the dictionary on the iPhone: Unbalanced calls to begin/end appearance transitions for UIFallbackPresentationViewController

UPDATE: When I present a UIAlertView and cancel's it the dictionary works again. Wonder why?

like image 512
adit Avatar asked Jan 05 '12 23:01

adit


2 Answers

At the moment there are 52 other questions on stackoverflow mentioning this error..

From reading a few i think the code apple is using is calling presentModalViewController: before the actual dictionary view is fully loaded.

I think this is just a bug which apple has to solve, Rudolf Adamkovic's sample made it clear:

  • Create "Single View Application"
  • Add UITextView
  • Run it
  • Select a word in the text view
  • Choose Define

  • Debug console tell's you something like this:

    Unbalanced calls to begin/end appearance transitions for 
    <_UIFallbackPresentationViewController: 0x74c1660>
    

I filed the bug at: https://bugreport.apple.com

Sample code: https://github.com/tiemevanveen/DefineBugDemoProject

like image 76
Tieme Avatar answered Oct 23 '22 13:10

Tieme


Without seeing your code it is going to be really hard to give an answer to this question. It would be much easier if you would show your logic.

That being said, here are a couple of tips that might help:

  1. Make sure you are calling all appropriate super methods in your class. For example, if you override viewDidAppear:animated or viewDidLoad, make sure you call the super methods.
  2. Checkout this thread...maybe you are doing some sort of animation in an inappropriate place?
like image 1
Michael Frederick Avatar answered Oct 23 '22 13:10

Michael Frederick