[Adium-devl] Plugin: Unable to add method to AIPreferenceController using category

Henrik Nyh henrik at nyh.se
Thu May 24 13:56:41 UTC 2007


On 24/05/07, Evan Schoenberg <evan at adiumx.com> wrote:
>
> On May 24, 2007, at 9:22 AM, Ofri Wolfus wrote:
>>  If #import <Adium/AIPreferenceController.h> can't find the
>> header how come the other #imports do?
> This should be #import
> <Adium/AIPreferenceControllerProtocol.h>.  The header for
> AIPreferenceController itself is not public.

If I just import <Adium/AIPreferenceControllerProtocol.h>, I get
"error: cannot find interface declaration for
'AIPreferenceController'". Small test case for this (as
"FileTransferFoldersPerSenderPlugin.m"):

    #import <Cocoa/Cocoa.h>
    #import <Adium/AIPlugin.h>
    #import <Adium/AIAdiumProtocol.h>
    #import <Adium/AIPreferenceControllerProtocol.h>


    @interface AIPreferenceController (MyCat)
    - (void)foobar;
    @end

    @implementation AIPreferenceController (MyCat)
    - (void)foobar {
    	NSLog(@"FOOBAR!");
    }
    @end


    @interface FileTransferFoldersPerSenderPlugin : AIPlugin {
    }
    @end

    @implementation FileTransferFoldersPerSenderPlugin
    @end



> No idea why your category
> isn't working.  You said you've tried directly swizzling the method, too?

Haven't tried swizzling yet, since I planned to add a method with a
category and then swizzle. Since I can't get adding the method to
work, I haven't gone further.

/ H




More information about the Adium-devl mailing list