Hello I want to use Google Maps API in my project and I have added libz.dylib. When I write
-ObjC in other linker flag for linking Google Maps API, its working well but when I remove this flag tan -lz library is not found error found, so please help me to solve this problem.
-ObjC flag there where it is.
According to the Google Maps SDK docs for iOS, the
-ObjC flag is required.
In the Other Linker Flags section, add -ObjC. If these settings are not visible, change the filter in the Build Settings bar from Basic to All.
If you want more insight, please refer to the Apple technical Q&A QA1490
The problem arises with categories on static libraries, which are not linked by default
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.
Apparently Google Maps APIs make use of categories on their static library, therefore you need the
-ObjC flag to change the linker behavior, as explained in the Q&A
To resolve this issue, the target linking against the static library must 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.