¿Puede una biblioteca estática de iOS contener clases/interfaces que puedan ser utilizadas/implementadas por el código de iOS que utiliza la biblioteca?

I apologize if this is a dumb question, or if it does not make sense. I've written some Objective-C code before, but I am not very familiar with writing code for OS X or iOS; I'm pretty much a novice. Currently, I'm trying to port a project from OS X into iOS. The project compiles into a Framework, that other OS X projects can use.

I'm trying to do something similar for iOS. I understand that iOS does not support Frameworks that contain dylibs and that the solution is to create a static library. However, the OS X Framework has several classes (in .m files) that the implementing code uses, extends, or implements. All the examples I've seen for static libraries seem to define a header-file with some functions that can be compiled into a static library.

Is it possible to have classes inside the static library, that iOS code can use? Also, how can I tell if the code is using dynamic libraries?

preguntado el 29 de julio de 12 a las 20:07

Your assertions are not entirely true. iOS Does support frameworks, they just cannot contain dylibs. Very important distinction there. -

@RichardJ.RossIII Thanks for the clarification! Like I said, I'm a novice. How can I tell if the code i'm porting uses dynamic libraries? -

1 Respuestas

Yes, static libraries can contain Objective-C classes.

In some cases, you will need to pass options to the linker to force it to include all of the classes and categories defined in a static library. See http://developer.apple.com/library/mac/#qa/qa1490/_index.html

Respondido 30 Jul 12, 18:07

Richard commented on my question and said that I cannot convert the project over if it contains dynamic libraries. I know that the project uses third-party libraries. Are those considered dynamic libraries? - vivin paliath

You won't be able to use any OS X libraries, dynamic or static, on iOS. You will need iOS versions of those libraries, and if the third-party vendors don't supply them, and their source code is not available, then you can't use them. - cristobal johnson

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.