OCMock - trying to mock NSEntityDescription - objective-c

in order to test a managed class I tried to create an instance in a unit test by first trying to mock NSEntityDescription and NSManagedObjectContext.
id mockEntityDesc = [OCMockObject niceMockForClass:[NSEntityDescription class]];
id mockManagedObjectContext = [OCMockObject mockForClass:NSManagedObjectContext.class];
But before I can get any further I get the following error when test is run;
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in CallsCoordinatorTests.o
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in CallsCoordinatorTests.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any advice please?
Thanks

Your unit test target is not linking with the Core Data framework.

Related

Undefined symbol: _swift_getOpaqueTypeConformance - React Native & SwiftUI

I'm trying to port a SwiftUI view into react native following this guide. It build fine in swift project but not in a react native project.
I'm getting the following error:
Undefined symbols for architecture x86_64:
"_swift_getOpaqueTypeConformance", referenced from:
lava.ColorWheelView.body.getter : some in ColorWheelView.o
closure #2 (SwiftUI.GeometryProxy) -> <<opaque return type of lava.ColorWheelView.makeView(SwiftUI.GeometryProxy) -> some>>.0 in lava.ColorWheelView.body.getter : some in ColorWheelView.o
associated type witness table accessor for SwiftUI.View.Body : SwiftUI.View in lava.ColorWheelView : SwiftUI.View in lava in ColorWheelView.o
l_get_witness_table qd0__7SwiftUI4ViewHD3_AaBPAAE7gesture_9includingQrqd___AA11GestureMaskVtAA0F0Rd__lFQOyAA15ModifiedContentVyAA6ZStackVyAA05TupleC0VyAJyAA06_ShapeC0VyAA9RectangleVAA5ColorVGAA12_FrameLayoutVG_AJy4lava010GuitarPickC0VAA13_OffsetEffectVGtGGAA09_PositionP0VG_AA06_EndedF0VyAA0f5StateF0VyAA08_ChangedF0VyAA04DragF0VGSo7CGPointVSgGGQo_HO in ColorWheelView.o
associated type witness table accessor for SwiftUI.View.Body : SwiftUI.View in lava.TrianglePath : SwiftUI.View in lava in GuitarPickView.o
associated type witness table accessor for SwiftUI.View.Body : SwiftUI.View in lava.GuitarPickView : SwiftUI.View in lava in GuitarPickView.o
"_swift_getTypeByMangledNameInContextInMetadataState", referenced from:
___swift_instantiateConcreteTypeFromMangledNameAbstract in ColorWheelView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
To reproduce I made this Github repo
Copy those files in a react native project and try to build. Make sure to replace the header file import with your test project name "<Replace This>-Swift.h"
My build target is iOS 13.5 iPhone 11 Pro Max simulator.

Undefined symbols for architecture arm64 - Google Mobile Ads

I'm trying to add Google Mobile Ads SDK 7.6
But i'm getting a lot of errors, and i can't solve it. Under here i have some of the errors.
Undefined symbols for architecture arm64:
"_UITransitionContextFromViewControllerKey", referenced from:
-[GADViewControllerFullScreenSwipeAnimation animateTransition:] in GoogleMobileAds(GADViewControllerFullScreenSwipeAnimation.o)
-[GADViewControllerFullScreenSwipeAnimation animationContextForRestoringAnimationToSavedState:] in GoogleMobileAds(GADViewControllerFullScreenSwipeAnimation.o)
"_UITransitionContextToViewControllerKey", referenced from:
-[GADViewControllerFullScreenSwipeAnimation animateTransition:] in GoogleMobileAds(GADViewControllerFullScreenSwipeAnimation.o)
-[GADViewControllerFullScreenSwipeAnimation animationContextForTopToBottomAnimationPresentationWithTransitionContext:] in GoogleMobileAds(GADViewControllerFullScreenSwipeAnimation.o)
-[GADViewControllerFullScreenSwipeAnimation animationContextForBottomToTopAnimationPresentationWithTransitionContext:] in GoogleMobileAds(GADViewControllerFullScreenSwipeAnimation.o)
"_OBJC_CLASS_$_UIScrollView", referenced from:
objc-class-ref in GoogleMobileAds(GADSlot+SwipeToViewController.o)
"_OBJC_CLASS_$_UIPasteboard", referenced from:
objc-class-ref in GoogleMobileAds(GADAdView.o)
"_UIImageWriteToSavedPhotosAlbum", referenced from:
-[GADMRAIDPicture storeImage:] in GoogleMobileAds(GADMRAIDPicture.o)
"_CGSizeFromString", referenced from:
_GADCGSizeFromString in GoogleMobileAds(GADAdSize.o)
"_CATransform3DMakeRotation", referenced from:
-[GADAdView(VideoAdditions) rotateVideoToDegrees:] in GoogleMobileAds(GADAdView+VideoAdditions.o)
"_OBJC_METACLASS_$_UIGestureRecognizer", referenced from:
_OBJC_METACLASS_$_GADImpressionTicketGestureRecognizer in GoogleMobileAds(GADImpressionTicketGestureRecognizer.o)
_OBJC_METACLASS_$_GADAdViewTouchGestureRecognizer in GoogleMobileAds(GADAdViewTouchGestureRecognizer.o)
"_OBJC_CLASS_$_UIGestureRecognizer", referenced from:
_OBJC_CLASS_$_GADImpressionTicketGestureRecognizer in GoogleMobileAds(GADImpressionTicketGestureRecognizer.o)
_OBJC_CLASS_$_GADAdViewTouchGestureRecognizer in GoogleMobileAds(GADAdViewTouchGestureRecognizer.o)
"_UIViewNoIntrinsicMetric", referenced from:
-[GADBannerView intrinsicContentSize] in GoogleMobileAds(GADBannerView.o)
Thank you !
I found a solution. I had to use the #import GoogleMobileAds; instead of using #import <GoogleMobileAds/GoogleMobileAds.h>
That solved my problem.

connected to the project at Ada QT libraries

When connecting to a project on Ada QT library produces errors.
with QT; use QT;
.....
Log.
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x14): undefined reference to QChar1_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x30): undefined reference toQChar2_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x5a): undefined reference to QChar3_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x6f): undefined reference toQChar4_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x8b): undefined reference to QChar5_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0xa7): undefined reference toQChar6_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0xbb): undefined reference to QChar7_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0xcf): undefined reference toQChar8_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0xe3): undefined reference to QChar_latin1'
e:/gnat/2013/bin/../libexec/gcc/i686-pc-mingw32/4.7.4/ld.exe: E:\GNAT\2013\qtada\qt-qchar.o: bad reloc address 0x20 in section.eh_frame'
e:/gnat/2013/bin/../libexec/gcc/i686-pc-mingw32/4.7.4/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
gprbuild: link of main.adb failed
[2014-04-28 08:15:40] process exited with status 4 (elapsed time: 01.50s)
Are your installed QT,QTADA libraries compatible with the Mingw-Toolchain? Also regarding the bitness 32/64. The Versions of your libraries and the compile/linker command would be helpful.
You might also consider following hint:
GMP with MinGW on Windows

Undefined symbols while including Zxing to Xcode 4.3 + Obj-C

I am facing some problem while including ZXingWidget to my previous iOS project.
It is a project which I started earlier using XCode4.3+ARC for iOS. For this project I need to include ZXing to scan.
I had followed the README provided.
Copy zxing into project root, add ZXingWidget.xcodeproj project
Adding link libZXingWidget.a in build phases
Added ZXingWidget to target dependencies
Header Search Paths - recursive $(SRCROOT)/zxing-read-only/iphone/ZXingWidget/Classes
Header Search Paths - non-recursive $(SRCROOT)/zxing-read-only/cpp/core/src
Import all the required iOS frameworks.
Things to note:
ZXing compiled and run properly on iphone simulator
I am getting about 66 errors about undefined symbols. (example below)
Zxing code is obtained from SVN (I also tried the zip download, same but 64 errors)
But I could not import any file directly from my code
(#import not working).
I also tried this solution with no luck.
Any other possibilities that I am missing?
Any help is appreciated!
Some error output I am getting now.
Undefined symbols for architecture i386:
"std::ios_base::Init::Init()", referenced from:
___cxx_global_var_init in libZXingWidget.a(Binarizer.o)
___cxx_global_var_init in libZXingWidget.a(BinaryBitmap.o)
___cxx_global_var_init in libZXingWidget.a(Array.o)
___cxx_global_var_init in libZXingWidget.a(BitArray.o)
___cxx_global_var_init in libZXingWidget.a(BitMatrix.o)
___cxx_global_var_init in libZXingWidget.a(BitSource.o)
___cxx_global_var_init in libZXingWidget.a(Counted.o)
...
"std::terminate()", referenced from:
zxing::Binarizer::Binarizer(zxing::Ref<zxing::LuminanceSource>) in libZXingWidget.a(Binarizer.o)
zxing::Binarizer::~Binarizer() in libZXingWidget.a(Binarizer.o)
zxing::BinaryBitmap::BinaryBitmap(zxing::Ref<zxing::Binarizer>) in libZXingWidget.a(BinaryBitmap.o)
zxing::BinaryBitmap::~BinaryBitmap() in libZXingWidget.a(BinaryBitmap.o)
zxing::BinaryBitmap::getBlackRow(int, zxing::Ref<zxing::BitArray>) in libZXingWidget.a(BinaryBitmap.o)
zxing::BinaryBitmap::getWidth() const in libZXingWidget.a(BinaryBitmap.o)
zxing::BinaryBitmap::getHeight() const in libZXingWidget.a(BinaryBitmap.o)
...
"operator delete(void*)", referenced from:
zxing::Binarizer::~Binarizer() in libZXingWidget.a(Binarizer.o)
zxing::Counted::~Counted() in libZXingWidget.a(Binarizer.o)
zxing::BinaryBitmap::~BinaryBitmap() in libZXingWidget.a(BinaryBitmap.o)
zxing::BinaryBitmap::crop(int, int, int, int) in libZXingWidget.a(BinaryBitmap.o)
zxing::BinaryBitmap::rotateCounterClockwise() in libZXingWidget.a(BinaryBitmap.o)
zxing::Counted::~Counted() in libZXingWidget.a(BinaryBitmap.o)
zxing::BitArray::~BitArray() in libZXingWidget.a(BitArray.o)
...
"___cxa_allocate_exception", referenced from:
zxing::Counted::release() in libZXingWidget.a(Binarizer.o)
zxing::Counted::release() in libZXingWidget.a(BinaryBitmap.o)
zxing::BitArray::setRange(int, int) in libZXingWidget.a(BitArray.o)
zxing::BitArray::isRange(unsigned long, unsigned long, bool) in libZXingWidget.a(BitArray.o)
zxing::BitMatrix::setRegion(unsigned long, unsigned long, unsigned long, unsigned long) in libZXingWidget.a(BitMatrix.o)
zxing::Counted::release() in libZXingWidget.a(BitMatrix.o)
zxing::BitSource::readBits(int) in libZXingWidget.a(BitSource.o)
...
You need to rename main.m to main.mm. That will tell Xcode to link with the necessary C++ libraries, which is what are missing.

solve error : "Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1"

In my application I have integrate Three20 Library and Restkit framework, after this I am Build the code the error was generated
the error is :
`"Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1"`
and the error description is
ld: duplicate symbol _OBJC_METACLASS_$_RKJSONParser in /Users/pratikkanada/Desktop/Zipogo/Zipongo - working
version/RestKit/Build/Release-iphonesimulator/libRestKitJSONParserYAJL.a(RKJSONParser+YAJL.o) and
/Users/pratikkanada/Desktop/Zipogo/Zipongo - working version/RestKit/Build/Release-
iphonesimulator/libRestKitJSONParserSBJSON.a(RKJSONParser+SBJSON.o)
so, pls tell me how to solve this error
It seems that you have added that lib two times.
Please search libRestKitJSONParserSBJSON.a and (RKJSONParser+SBJSON.o) in entire code and you may found one of these added two times.
Simply solution is remove any one of two same files.