• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Writing a custom spell service
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Writing a custom spell service


  • Subject: Writing a custom spell service
  • From: Stefan Kreutter <email@hidden>
  • Date: Fri, 31 Aug 2001 16:37:26 +0200

I'm desperately trying to write my own spell service (like /System/Library/Services/AppleSpell.service) but I couldn't get things to work.

First of all the documentation [1,2] to NSSpellServer seems pretty old and outdated (has it ever been updated since the NEXTSTEP days? The example code uses cstrings and fprintf() and mentions a file named service for 'service availability notice' - no Info.plist)

I had a look at /System/Library/Services/AppleSpell.service and copied the that bundle-structure including Resources/Info-macos.plist. My executable is a foundation-tool based on the sample-code from the NSSpellServer. In the main() function I use NSLog and in addition fopen/fprintf to write a log-file to /tmp. The executable works when launching it from the commandline.

After installing the the service in /Library/Services or ~/Library/Services, logout/login I launch TextEdit and choose Edit->Spelling->Spelling... In the popup my spellchecker is listed but seems not to work at all. I get an alert dialog: "Couldn't contact Spell Checker". Neither the NSLog() statement nor the log file in /tmp gets created so it seems like the executable doesn't get started.

This is my Info-macos.plist (derived from AppleSpell's Info-macos.plist):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>ObjectFarmSpell</string>
<key>CFBundleIdentifier</key>
<string>com.apple.AppKit.ObjectFarmSpell</string>
<key>CFBundleName</key>
<string>ObjectFarmSpell</string>
<key>CFBundleShortVersionString</key>
<string>7.0</string>
<key>CFBundleVersion</key>
<string>7.0</string>
<key>NOTE</key>
<string>Please, do NOT change this file -- It was generated by ProjectBuilder.</string>
<key>NSBGOnly</key>
<string>1</string>
<key>NSExecutable</key>
<string>ObjectFarmSpell</string>
<key>NSExtensions</key>
<dict/>
<key>NSIcon</key>
<string>dummy.tiff</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSServices</key>
<array>
<dict>
<key>NSExecutable</key>
<string>ObjectFarmSpell</string>
<key>NSLanguages</key>
<array>
<string>German</string>
</array>
<key>NSSpellChecker</key>
<string>ObjectFarm</string>
</dict>
</array>
</dict>
</plist>

My executable is named ObjectFarmSpell and I register a NSSpellServer with this method:

[aServer registerLanguage:@"German" byVendor:@"ObjectFarm"]

But as I said it seems like the executable doesn't get launched.

The Bundle lauyout looks like this:

-rwxr-xr-x /Library/Services/ObjectFarmSpell.service/ObjectFarmSpell
-rw-r--r--
/Library/Services/ObjectFarmSpell.service/Resources/Info-macos.plist

Any ideas? I have no clue what I'm doing wrong... looks like there is something broken in Mac OS X 10.x.

-Stefan


References:

[1] file:///System/Library/Frameworks/Foundation.framework/Versions/C/Resources/
English.lproj/Documentation/Reference/ObjC_classic/Classes/NSSpellServer.html

[2] http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/
Classes/NSSpellServer.html


  • Follow-Ups:
    • Re: Writing a custom spell service
      • From: "David P. Henderson" <email@hidden>
    • Re: Writing a custom spell service
      • From: Ondra Cada <email@hidden>
    • Re: Writing a custom spell service
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Calling C++ from Obj-C
  • Next by Date: Re: regarding nib files.
  • Previous by thread: Re: regarding nib files.
  • Next by thread: Re: Writing a custom spell service
  • Index(es):
    • Date
    • Thread