Build Settings/Linking/Other Linker Flags
2014-12-14 17:10
459 查看
1> Problem was caused:
Objective-C does not define linker symbols for each function (or method, in Objective-C) - instead, linker symbols are only generated for each class. If you extend a pre-existing class with categories, the linker does not know to associate the object code of the core class implementation and the category implementation. This prevents objects created in the resulting application from responding to a selector that is defined in the category.
2> Solution:
To resolve this issue, the static library should pass the -ObjC option to the linker. This flag causes the linker to load every object file in the library that defines an Objective-C class or category. While this option will typically result in a larger executable (due to additional object code loaded into the application), it will allow the successful creation of effective Objective-C static libraries that contain categories on existing classes.
3> Detail:
-all_load Loads all members of static archive libraries.-ObjC Loads all members of static archive libraries that implement an Objective-C class or category.-force_load (path_to_archive) Loads all members of the specified static archive library. Note: -all_load forces all members of all archives to be loaded. This option allows you to target a specific archive.
Objective-C does not define linker symbols for each function (or method, in Objective-C) - instead, linker symbols are only generated for each class. If you extend a pre-existing class with categories, the linker does not know to associate the object code of the core class implementation and the category implementation. This prevents objects created in the resulting application from responding to a selector that is defined in the category.
2> Solution:
To resolve this issue, the static library should pass the -ObjC option to the linker. This flag causes the linker to load every object file in the library that defines an Objective-C class or category. While this option will typically result in a larger executable (due to additional object code loaded into the application), it will allow the successful creation of effective Objective-C static libraries that contain categories on existing classes.
3> Detail:
-all_load Loads all members of static archive libraries.-ObjC Loads all members of static archive libraries that implement an Objective-C class or category.-force_load (path_to_archive) Loads all members of the specified static archive library. Note: -all_load forces all members of all archives to be loaded. This option allows you to target a specific archive.
相关文章推荐
- 关于xcode7.2以后 Build Settings Linking 默认没有 Other Linker Flags选项的解决方法
- <iOS>关于Xcode上的Other linker flags
- 关于Xcode的Other Linker Flags
- 关于Xcode上的Other linker flags
- iOS 关于Xcode上的Other linker flags
- Other Linker Flags参数-ObjC、-all_load和-force_load讲解
- Other Linker Flags list
- 关于Xcode的Other Linker Flags
- Xcode:关于Other Linker Flags
- xcode的Targets选项下有Other linker flags的设置
- ios library Other Linker Flags
- ios library Other Linker Flags
- 关于Xcode的Other Linker Flags
- 关于Xcode上的Other linker flags
- cocos ios,other linker flags 加入 -objc 编译报错解决方案
- 关于Xcode的Other Linker Flags
- 2dx-lua Other Linker Flags 设置成 -ObjC 真机编译报错"_GCControllerDidDisconnectNotification"
- <iOS>关于Xcode上的Other linker flags
- Other Linker flags 添加 -Objc导致包冲突
- Other linker flags