4
   fourLetterWord = @"isdjfiodjof";
   if ([UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:fourLetterWord]) {
        self.display.text = fourLetterWord;
        return;
    }
    else
        fourLetterWord = @"";

This string is getting accepted. I do not know what I am doing wrong here, but before 4.5 this worked fine. Is this an issue with xcode 4.5, or is there something wrong with my code?

AGleasonTU
  • 2,775
  • 2
  • 14
  • 12
  • What's the problem? Are you getting to the else clause instead of the if? – rdelmar Sep 22 '12 at 02:46
  • The string "isdjfiodjof" is being accepted. It answers YES when it should answer NO since that is clearly not in the english dictionary. – AGleasonTU Sep 22 '12 at 18:47
  • I'm actually running into the same problem right now. Did you ever find a solve for this? I can't get it to return false anymore, used to work fine until recently. – AJak Oct 12 '12 at 17:31
  • Is this only in iOS6? Regardless, it sounds like a bug and should be logged with Apple at http://bugreport.apple.com. – Robotic Cat Oct 12 '12 at 17:40
  • Haven't gotten it to work, I hoped it would be fixed with the most recent update but it has not. Now I figure it is only an issue that apple can fix – AGleasonTU Oct 16 '12 at 16:49

3 Answers3

2

I just had the same issue and start working around it.[UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:fourLetterWord]) method doensn't work in the simulator for some reasons, Apple need to fix it.

BUT if you TEST YOUR APP IN THE DEVICE [UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:fourLetterWord]) method runs and gives you the right result.

it's kinda slow though.

hope helps.

lionserdar
  • 2,022
  • 1
  • 18
  • 21
1

dictionaryHasDefinitionForTerm: always returns YES if no dictionary has been downloaded yet (because if there is no dictionary, it can't know whether the word is in it).

The download is automatically offered when you actually show a dictionary popover in any app. I think the download-on-demand feature was introduced in iOS 6, along with dictionaries in languages other than English.

omz
  • 53,243
  • 5
  • 129
  • 141
0

My experience is that this works fine on my iPad running iOS 5.1.1 but returns TRUE every time on my iPod running iOS 6.1.3. I've logged it as a bug with Apple.

Update: omz is right. Once I had downloaded Apple's dictionary onto my iOS6 iPod then it validates the word correctly. It was so long ago that I installed iOS5 on my iPad I had no memory of whether I'd installed it manually or if it was done for me. Regardless, it requires a manual install on iOS6 for this method to be of use.

Stephen Watson
  • 1,700
  • 16
  • 17