3

I want to access a constant NSString that is defined in a framework in objective-c without statically linking to the framework. I'm working on a framework myself and I don't want to link against the other framework because I know that some clients of my framework won't support the new framework. I've found that I can dynamically load a framework using NSBundle and that I can dynamically create instances of the class by using NSClassFromString, but the compiler (actually I guess it's the linker) won't let me use constants because they are undefined symbols.

Edit: I have a suspicion that my answer is here: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html

I found the answer here: How do I weak link frameworks on Xcode 4?

What happens then if I try and access something from the framework? Do I just get nil?

Cœur
  • 37,241
  • 25
  • 195
  • 267
JPC
  • 8,096
  • 22
  • 77
  • 110

0 Answers0