Why Applespell.service fail to launch?

  • Our application use Mac OS X spell checker service to do spell check.
    here is sample code . [[NSSpellChecker sharedSpellChecker]
    checkSpellingOfString:@"hello" startingAt:0];
    But the problem is AppleSpell.service can not launch automatically by
    this code, so there is always an alert: couldn't contact spell checker!
    I try other applications (Openoffice.org, textEdit ) and they both can
    launch AppleSpell.service automatically, I think it means, nothing
    wrong on my machine.
    Who can tell me how to force AppleSpell.service to launch? or is there
    a way to check why AppleSpell.service fail to launch?
    Thanks in advance!
  • Our application use Mac OS X spell checker service to do spell check.
    here is sample code . [[NSSpellChecker sharedSpellChecker]
    checkSpellingOfString:@"hello" startingAt:0];
    But the problem is AppleSpell.service can not launch automatically by this
    code, so there is always an alert: couldn't contact spell checker!
    I try other applications (Openoffice.org, textEdit ) and they both can
    launch AppleSpell.service automatically, I think it means, nothing wrong on
    my machine.
    Who can tell me how to force AppleSpell.service to launch? or is there a way
    to check why AppleSpell.service fail to launch?
    Thanks in advance!
  • This code works just fine for me:

        NSLog(@"%@", NSStringFromRange([[NSSpellChecker
    sharedSpellChecker] checkSpellingOfString: @"hello, hwo are you
    today?" startingAt: 0]));

    Which prints '{7, 3}', as expected. I'll go out on a limb and guess
    that you're trying to access the spell checker from an atypical
    context. Is this code failing in a bread-and-butter Cocoa app launched
    from the Finder? Or are you doing something fancy like, say, writing a
    launchd daemon or agent or something other than a 'normal' Cocoa app?

    David
  • Hi, Dave,
    Thanks for your response. This sample code normally works well in most
    cases.
    Is Applespell.service launched by [[NSSpellChecker sharedSpellChecker] ? or
    launched automatically by a NSTextView?
    I guess the problem in our application might be caused by library conflict
    but I do not know how to check it. Our application is a normal cocoa app.

    2009/7/3 Dave Keck <davekeck...>

    > This code works just fine for me:
    >
    > NSLog(@"%@", NSStringFromRange([[NSSpellChecker
    > sharedSpellChecker] checkSpellingOfString: @"hello, hwo are you
    > today?" startingAt: 0]));
    >
    > Which prints '{7, 3}', as expected. I'll go out on a limb and guess
    > that you're trying to access the spell checker from an atypical
    > context. Is this code failing in a bread-and-butter Cocoa app launched
    > from the Finder? Or are you doing something fancy like, say, writing a
    > launchd daemon or agent or something other than a 'normal' Cocoa app?
    >
    > David
    >