• 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
Still need help with Services. Is there sample code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Still need help with Services. Is there sample code?


  • Subject: Still need help with Services. Is there sample code?
  • From: Daryle Walker <email@hidden>
  • Date: Tue, 16 Sep 2014 08:22:36 -0400

Still can’t get my Service to trigger.

> daryle$ /Applications/TextEdit.app/Contents/MacOS/TextEdit -NSDebugServices io.github.me.MyApp
> 2014-09-16 08:00:58.493 TextEdit[546:507] NSDebugServices=io.github.me.MyApp
> Open URL (io.github.me.MyApp) is explicitly enabled in the services menu and enabled in the context menu, in preferences.
> Open URL (io.github.me.MyApp) is explicitly enabled in the services menu and enabled in the context menu, in preferences.
> Open URL (io.github.me.MyApp) is disqualified because its send and/or return types cannot be handled by the requestor <NSTextView: 0x7fc35345d950>
>     Frame = {{0.00, 0.00}, {550.00, 420.00}}, Bounds = {{0.00, 0.00}, {550.00, 420.00}}
>     Horizontally resizable: NO, Vertically resizable: YES
>     MinSize = {550.00, 420.00}, MaxSize = {179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00}
> .

The first two lines after the command always appear. The rest of the lines happen every time I open the Services menu, no matter the context. (The error messages are happening when the system checks if my Service qualifies.) Web-searching got only one hit on "is disqualified because its send and/or return types cannot be handled by the requestor”; the page was from Stack Overflow. It mentioned a post on this list from 5 years ago, suggesting adding an “NSRequiredContext” entry. It didn’t help me; still getting the same error. (The “MaxSize” numbers are one huge line; it wraps here.)

I’m stumped. I’ve been looking for Apple sample code, but since it likes tacking on “service” to 80% of its stuff, I can’t find anything.

Here’s the Services portion of my Info.plist, in case I’m still missing something simple:

> 	<key>NSServices</key>
> 	<array>
> 		<dict>
> 			<key>NSMenuItem</key>
> 			<dict>
> 				<key>default</key>
> 				<string>Open URL</string>
> 			</dict>
> 			<key>NSMessage</key>
> 			<string>openURL</string>
> 			<key>NSPortName</key>
> 			<string>Prairie</string>
> 			<key>NSSendFileTypes</key>
> 			<array>
> 				<string>public.text</string>
> 			</array>
> 			<key>NSRequiredContext</key>
> 			<dict>
> 				<key>NSServiceCategory</key>
> 				<string>public.text</string>
> 			</dict>
> 		</dict>
> 	</array>

I could post the source code again, but the lack of any logging from that method means the process is failing before the method would be called. I did at one time add an -init and -dealloc with logging just to make sure the object was created and retained. I got just the init message, which means that the service provider was being retained and not instant-deallocated.

Oh, the Stack Overflow page was <http://stackoverflow.com/questions/1370616/nsservices-not-working> and the referenced post was <http://lists.apple.com/archives/Cocoa-dev/2009/Sep/msg00201.html>.

—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Still need help with Services. Is there sample code?
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Nib unloading and ARC
  • Next by Date: Re: Want NSTableView NSOutlineView to load lazy like iOS?
  • Previous by thread: Re: Updating Content of NSFileWrapper
  • Next by thread: Re: Still need help with Services. Is there sample code?
  • Index(es):
    • Date
    • Thread