The enable modules (c and Objective-C) do not work properly in the Static Library along with the Obj-C linker flag

I am developing an iOS static library and am using CoreLocation and MapKit in a static library. Xcode 5 with LLVM 5 has a new build setting "Enable Modules (C and Objective-C)" and "Automatically Link Structures"

These settings eliminate the need to add a dependent structure, including the static library in the Target application.

However, this seems to work only if the “-ObjC” flag is added to the other linker flags, even though the flag is not needed, since I do not have Objective-C categories to load from the static library.

Here you can find a sample project ( http://cl.ly/0Z1i1U1w3C3P ) to try this. Please let me know any suggestions. Is there any correlation between the -ObjC flag and the new build setting in LLVM5?

Regarding the sample application:

There are two projects 1. libTest 2. StaticLibApp

The open application StaticLib and libTest are added as its subproject libTest has the class libTest.h and .m by checking one class + (void). Where I am trying to reference the CLLocation and MKMapView objects.

StaticLibApp compiles fine if the '-ObjC' flag is added to other linker flags, otherwise it causes compilation. Error: CLLocation and MKMapView class symbol not found.

+4

Source: https://habr.com/ru/post/1546443/


All Articles