Adding OCMock to a framework - frameworks

A bit of background first, I am currently writing some ocunit tests for a universal framework, and now need to add OCMock to test some networking aspects of the framework. I have followed the OCMock instructions here and downloaded the sample project as a reference. I've added libOCMock.a in Link Binary with Libraries in the Build phases and added the header location to Header Search path and set the linker flags to
-ObjC
-force_load
"$(SRCROOT)/Libraries/libOCMock.a"
The error message I'm getting when I run my tests is as follows:
ld: 73 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help would be greatly appreciated

Related

Xcode Build Failure on Archive, but not on Run with ResearchKit

I'm trying to build a project that has ResearchKit in it, and whenever I build and run on a physical device (or the simulator, for that matter) it works fine. But when I attempt to Archive it, I get the following error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_ORKVisualConsentStep", referenced from:
objc-class-ref in InformedConsent.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I followed the installation guidelines on the ResearchKit GitHub, and made sure to check that researchKit.framework was under the Frameworks, Libraries and Embedded Content section as well as the "Link Binary With Libraries" section of the build phases tab (as was described in this link as well as a couple others: Xcode build failure "Undefined symbols for architecture x86_64") but still nothing.
Is there something I'm doing wrong, or another setting I might be able to change?
UPDATE:
I noticed that the element that was throwing the error - ORKVisualConsentStep - was deprecated a few iOS versions ago. So by taking that out, I was able to get the project to archive.
I didn't want to put this as the accepted answer, though, because I wanted to see if there was a better solution than just deleting code.
Thanks for your help!

ld: framework not found CouchbaseLiteSwift

I'm getting an error
ld: framework not found CouchbaseLiteSwift
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I imported CouchbaseLiteSwift.framework on a folder frameworks like image show
i also included it on embedded binaries, and on framework search path i added :
$(PROJECT_DIR)/Frameworks
/Users/user/Documents/CouchbaseLiteTest/Frameworks
$(PROJECT_DIR)
/Users/user/Documents/CouchbaseLiteTest/Frameworks/CouchbaseLiteSwift.framework
$(inherited)
But still have this error, please help

Linker command failed with exit code architecture i386 xcode

I have an app that I am using various other Frameworks and libraries in.
FacebookSDK, GoogleSignIn, libsqlite3
I have included these in my buildSettings and even put Facebook in my Frameworks path and libxml2 in the Header Search Path.
However when I build in the simulator I get 21 errors which say
"linker command failed with exit code 1
ld: symbol(s) not found for architecture i386
this only happens with the simulator not on any device.
I am attaching a screen shot.
Any ideas would help. I have look at a lot of questions with this with no solution.
The lines in yellow are telling you the problem. When you compile for the simulator you are producing i386 code, for a real device you are producing ARM code. The libraries you are using do not contain i386 code, hence the errors.
You need to obtain versions of the libraries with i386 code.
HTH

Undefined symbols for architecture i386 when adding FaceBook Connect

I have the following failed code when i run my application on iPhone 5.1 simulator. My app runs smoothly before i add in the Facebook Connect into my application.
Undefined symbols for architecture i386:
"_FBCreateNonRetainingArray", referenced from:
-[FBSession initWithKey:secret:getSessionProxy:] in FBSession.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
May I know what can i do to get rid of this?
Thanks
2 things that usually get rid of that error.
1) go to: target > build phases > link binary with library -- make sure you've added the correct framework
2) go to: target > build phases > compile sources -- add any implementation files that are in your program but do not appear in that list.
Those two steps usually fix that kind of error.

lib commonCrypto not available for iOS simulator?

I've been adding libCommonCrypto.dylib to my project to do md5 hash verification. Works all proper on the iPhone (iOS 5.1), but when I try to run it on the simulator, I get this error:
ld: library not found for -lcommonCrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm a bit clueless why this happens. I added the commonCrypto to the project target -> build phase -> link binary with libraries. Is there any additional step required to get it working also in the simulator?
You don't have to add that dynamic library. It is available by default in
iphoneOS >> usr/include
and
iphoneSimulator >> usr/include