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

Ofri Wolfus ofri.wolfus at gmail.com
Thu May 24 16:29:15 UTC 2007


I believe this (combined with the header import) is what causes the  
weird behavior we're seeing. Try removing that flag and #import, and  
instead use @class AIPreferenceController and set the bundle loader  
(in your plugin's configuration section) to /Applications/Adium.app  
(or wherever your Adium is located).

And if you feel like knowing what really happens here, add the  
following category to your plugin and list the results of -[NSBundle  
classes] (with your plugin's bundle of course. You can easily get the  
bundle using +[NSBundle bundleForClass:]) before making the changes I  
suggested. If I was right, AIPreferenceController will be in the  
results ;)

@interface NSBundle (DPAdditions)

/*!
  * @abstract Returns all classes the receiver loaded.
  */
- (NSSet *)classes;

@end

#import <objc/objc-class.h>
#import <objc/objc-runtime.h>

@implementation NSBundle (DPAdditions)

- (NSSet *)classes {
	CFMutableSetRef set = CFSetCreateMutable(kCFAllocatorDefault, 0, NULL);
	int i, count = objc_getClassList(NULL, 0);
	Class *classes = calloc(count, sizeof(Class));
	
	objc_getClassList(classes, count);
	
	for (i = 0; i < count; i++) {
		Class cls = classes[i];
		
		if ([[NSBundle bundleForClass:cls] isEqualTo:self])
			CFSetAddValue(set, cls);
	}
	
	free(classes);
	return [(NSSet *)set autorelease];
}

@end


- Ofri

- - - - - - - - - - - - - - - - - - -
http://www.dpompa.com
- - - - - - - - - - - - - - - - - - -


On 24/05/2007, at 16:33, Henrik Nyh wrote:

> I use the other linker flags "-undefined dynamic_lookup" per
> http://fadeover.org/blog/archives/25. What flags could I add to do
> what you describe?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20070524/97a61296/attachment-0001.html>


More information about the devel mailing list