objective c - Dynamically load custom plugins (libraries) in a Cocoa application -


I have developed a Cocoa app for Mac OS X. I want to create some custom plugins (also with the interface) and want to load it dynamically.

In my app my app should appear inside a folder and retrieve all the files (plugins) The user should be made available in the interface.

Can someone recommend me a starting point?

How can I load them dynamically, do plugins dynamic library or STH?

Thank you.

You want to take a look at A loadable bundle (a framework is a loadable bundle) The project will produce whatever you want. If you set the principleClass property of the bundle in the top-level class of your code, you can retrieve an example of a class from the loaded bundle. You can load a bundle on a path with

  id bundle = [NSBundle bundleWithPath: pathToBundle]; NSError * err; If ({[Bundle Load Andrator Error: & Error]) {// Error contains error information} Other {// bundle properly loaded class plugin class = [bundle principle class]; // Quick plugin class and stop ...}    

Comments