Init not called on ObjC plugin

OK, I am probably making a very basic mistake here, but I don’t know what it is.

I just created a new Objective C plugin using the Glyphs Plugin xcode template from the SDK. The implementation is:

#import "TestPlugin.h"

@implementation TestPlugin

- (id) init {
    NSLog(@"Hello world");
	self = [super init];
	if (self) {
		// do stuff
	}
	return self;
}

- (NSUInteger) interfaceVersion {
	// Distinguishes the API verison the plugin was built for. Return 1.
	return 1;
}

@end

(i.e., all I did was add an NSLog call.) Then I built it, added it to the Plugins directory, and restarted Glyphs. The plugin shows up in the Preferences, but there’s nothing in the Console log to tell me that this has been initialized.

Should I expect the plugins to be initialized when Glyphs is opened, or some other time?

What kind of Plugin is it?

Just a general plugin.

Move the NSLog() into the if clause.

Still nothing. (Just as well; that would go against everything I know about control flow. :slight_smile: )

I meant that leaving the if clause empty is not a good idea.

Nothing else in Console.app? If it fails, it should say something like, ‘there is a problem with plugin x’.

the sample code of the general plugin was not correct. I fixed it.

Ah, thanks - that works now. In a few days I should have an interesting plugin…