Re: NSService - I need a headslap
Re: NSService - I need a headslap
- Subject: Re: NSService - I need a headslap
- From: Steve Cronin <email@hidden>
- Date: Wed, 04 Feb 2009 09:03:27 -0600
Well, sheesh - that's embarrassing! There is no 'self' until init -
I know that! Ugh.
However, that doesn't change my end result!
I never see anything on the Services menu nor anything from the NSLog
statements shown below.
(Even when I double-click on the .service file; after whcih I CAN see
it in the process list in Activity monitor but still no log messages)
Logging out and back in doesn't make my service name appear on the
Service menu...
This is on a 10.5.6 system using a Release build which has been placed
in ~/Library/Services.
SO my basic questions still stand:
What event/conditions launches a .service which resides in ~/Library/
Services?
Should/must .service files be 'Background Only'?
Am I missing something basic in my setup here -
I have only a Info.plist and 1 .h (NSObject) and 2 . m files (main and
MyService) and no .xib?
Other than the 'wrapper' settings are there other compiler settings
required for this setup?
I have only 2 steps in my build process: 'Compile Source (2)' and
'Link Binary w/ Lib (1)' [Cocoa]
To me it feels like there is something basic about the application
package that is not right but then I can't seem to keep 'self'
straight either...
MyService.m
-(id) init {
[super init];
NSLog(@"*[%@ %@]",[self class],NSStringFromSelector(_cmd));
[NSApp setDelegate:self];
return self;
}
- (void) applicationDidFinishLaunching:(NSNotification *)aNote {
[NSApp setServicesProvider:self];
void NSUpdateDynamicServices(void);
}
- (void) myServiceName:(NSPasteboard *)pboard userData:(NSString
*)userData error:(NSString **)error {
.....
}
On Feb 4, 2009, at 5:47 AM, Ron Fleckner wrote:
On 04/02/2009, at 7:44 PM, Steve Cronin wrote:
+(void)initialize { [NSApp setDelegate:self]; }
Hi Steve,
as Quincey has suggested, looks like the above is the problem. I've
done a stand-alone .service and [NSApp setDelegate:self] is in -
(id)init, not + (void)initialize.
Ron
_______________________________________________
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