I’m trying out GorillaLogic’s FoneMonkey 5 to see how it’s going to help us with automated testing for the iOS applications. Documentation on how to set it up is adequate but missed out on a scenario wherein a static library is used on another static library. My iOS project is, of course, working prior to setting up FoneMonkey as described in the documentation. After setting up and running Build, I get Duplicate Symbol error in the build console which is similar to this and this happens during linking.
ld: duplicate symbol _OBJC_IVAR_$_<ClassName>.<ClassProperty> in /Users/<username>/Library/Developer/Xcode/DerivedData/<ProjectName>-eatcdudkfbhgupaknrguharwtxze/Build/Products/Debug-iphonesimulator/lib<StaticLibraryName>.a(<ClassName>.o) and /Users/<username>/Library/Developer/Xcode/DerivedData/<ProjectName>-eatcdudkfbhgupaknrguharwtxze/Build/Products/Debug-iphonesimulator/lib<StaticLibraryName>.a(<ClassName>.o) for architecture i386
The scenario is this:
- Static Library A and Static Library B are referenced by My Project.
- Static Library A is referenced by Static Library B.
When you use the –all_load in the Other Linker Flag as the documentation instructed, you’ll get the duplicate symbol error. When you remove it, your project will compile but won’t show the FoneMonkey console in your app.
The solution is to replace –all_load with –force_load <path>/libFoneMonkey.5.0b.a. Replace <path> with the path to your libFoneMonkey.5.0b.a relative to your app’s Xcode project. Here’s an excerpt from the Mac OS X Developer Library that explains the difference between –all_load and –force_load:
-all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code. -force_load is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.
There it is! I hope I saved you some headache!
I’m still in the exploration stage. It looks promising! Feel free to share your thoughts on FoneMonkey.