Search code examples
iosswiftxcodeaws-mobilehub

AWS Mobile Hub Integration Linker Error "Mach-O"


Recently I was trying to integrate my app with AWS mobile hub. I followed the AWS instructions rigorously, but always got a lot of Mach-O linker errors like "_OBJC_CLASS_$_FBSDKLoginManager, referenced from:, "_OBJC_CLASS_$_AWSLambdaInvoker", referenced from:, and Linker command failed with exit code 1 (use -v to see invocation). To fix this I tried downloading these mentioned frameworks separately and include in my project, but the last error Linker command failed with exit code 1 (use -v to see invocation) just cannot be got rid of.


Solution

  • Finally I found out the problem was caused by a conflict between my existing Cocoapods installation and the AWS frameworks. Or more specifically due to the -ObjC flag put in the linker flags. I solved the problem by doing these:

    1. So far I only use the Cocoapods for one vendor's frameworks so I uninstalled Cocoapods following the instructions given at https://stackoverflow.com/a/16427883/1724059, and installed the frameworks included in Cocoapods independently
    2. Removed "-ObjC -framework " in linker flags

    The second step above is very important. It may be possible that one can continue using Cocoapods but set the linker flags in different ways and build successfully too.