Two scenarios:
a) I am compiling an App which uses a static library which contains a weak reference to a symbol that doesn't exist in the final binary. This is ok because the static library checks if the class is nil before using it (I create the static library). The reference is definitely weak:
// in code
asm(".weak_reference _OBJC_CLASS_$_DDLog");
// resulting static library
$ nm -m AirTurnInterface | grep DDLog
(undefined) weak external _OBJC_CLASS_$_DDLog
Ld complains that the symbol does not exist during final link. Surely this should not happen?
b) I produce example code which uses a new Apple API if it exists, again checking if the class is nil. However, even by forcing a weak reference as above, when compiling with Xcode 6 it complains the symbol is missing.
Other than using -undefined dynamic_lookup in the host App, which ignores all undefined symbols weak or otherwise, is there a way to get ld to respect weak references? Maybe I'm missing or misunderstanding something here, this is pretty new to me.