Importing a custom super class with static library - ios

I have a static library that I use on a number of different projects and have recently run into a linker error when refactoring it to split a class in two subclasses.
The error is:
"_OBJC_CLASS_$_APIServiceManager", referenced from:
objc-class-ref in libAPIServices.a(APIAuthenicationService.o)
_OBJC_CLASS_$_APIHTTPRequestServiceManager in libAPIServices.a(APIHTTPRequestServiceManager.o)
objc-class-ref in libAPIServices.a(APIService.o)
_OBJC_CLASS_$_APIJSONRequestServiceManager in libAPIServices.a(APIJSONRequestServiceManager.o)
objc-class-ref in libAPIServices.a(APIJSONRequestServiceManager.o)
"_OBJC_METACLASS_$_APIServiceManager", referenced from:
_OBJC_METACLASS_$_APIHTTPRequestServiceManager in libAPIServices.a(APIHTTPRequestServiceManager.o)
_OBJC_METACLASS_$_APIJSONRequestServiceManager in libAPIServices.a(APIJSONRequestServiceManager.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
where APIServiceManager is the superclass with APIHTTPRequestServiceManager and APIJSONRequestServiceManager being the subclasses.
In the subclasses I'm importing the super using:
#import "APIServiceManager.h"

Click to your project name in Xcode (top left corner) to open project setting than select your project target than in main menu select build phases and in build phases options goto link binary with libraries and add all your static libraries frameworks here.
see screen shot..

I got there in the end, it turned out that I was not including the super class in "Compile Sources" section of the library project

Related

SWRevealViewController Build Error

Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AppDelegate", referenced from: objc-class-ref in main.o
ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I am trying to use SWRevealViewController in my project, it gives above error.
I dragged and dropped both files i.e. SWRevealViewController.h and SWRevealViewController.m in my project.
If you are using these files in swift project then please make sure #import "SWRevealViewController.h" in your Bridging Header file.
Updated:
Please follows the below steps;
click on the your project name -> Click on Build Phases tab -> Compile Sources and then check to see whether SWRevealViewController.m is actually added to the list. If not, click + button -> Type SWRevealViewController.m -> Select and then Add it.
After that clean the project then again build and run.
Enjoy..!

iOS: Undefined symbols for architecture i386

I'm trying to implement ios-oauthconsumer
but I'm getting this error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_OAMutableURLRequest", referenced from:
objc-class-ref in ViewController.o
"_OBJC_CLASS_$_OAConsumer", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried to add the files following this solution but Xcode re-adds the file to the project. For example:
Any of you knows a way were I can add the files to the "Compile Sources" without having to re-add the file?
I'll really appreciated you help.
Make sure that each source file that needs to be linked is part of the Compile Sources section of your target. You can verify this by selecting your project in Navigator pane (as shown in your screenshot) and expanding the section shown here:
Xcode Compile Sources
You can also verify this by selecting the files and viewing their target membership in the Utilities pane in xcode.
Target Membership

How to use private framework's .h file in Xcode

I am trying to use SBSRemoteNotificationClient.h file of SpringBoardServices framework downloaded from GitHub. I directly drag and dropped downloaded SBSRemoteNotificationClient.h file into Xcode and tried to compile it. But I am facing below error during compiling.
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_SBSRemoteNotificationClient", referenced from:
objc-class-ref in MyClass.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I added #import "SBSRemoteNotificationClient.h" to my MyClass.m file.I also added path of SBSRemoteNotificationClient.h in Build Settings -> Search paths -> User Header Search paths like this /Users/awsuser006/Desktop/iphone-private-frameworks-master/SpringBoardServices/
But I am facing above mentioned error. Is this the right way of using .h files of private frameworks?
This is a linker error. The header was correctly parsed, but the framework symbols were not found. Make sure you are linking the SpringBoardServices framework.
Use
find /Applications/Xcode.app/ -name 'SpringBoardServices.framework'
to find it, then add -framework SpringBoardServices and -F /the/path/returned/by/find/ (without SpringBoardServices.framework at the end of the path) to your compilation flags.
Adding the framework using Build Phases > Link Binary With Libraries > (+) in your Xcode project may also work.
Find the framework symbols
Drag & drop them into Link with binaries...

Error with CJSONDeserializer IOS

I am new with XCode and iOS. I want to create a BD at a remote web service.
My problem is with this error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CJSONDeserializer", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have a target, with the group of project with viewController.h and .m And other group with JSON libraries. Maybe, i have to configure something. I don't know.
It's very similar:
Select the project in the project navigator.
Select the Target in the detail view.
Select the Build Phase tab.
Expand the Compiled Sources section
Add the file CJSONDeserializer.m if it is not present there.
This will hopefully solve your problem

Linker command failed with exit code1 in iOS while using static library file

I create a static library file and used this in another project and build it then I got the error message as bellow.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Test_For_Static", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please give suggestions to resolve this error.I create a static library by following this link
http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/
Add both projects into an Xcode workspace and simply make the static library a dependency of the other project. You will need to configure header search paths and then Xcode should take care of the rest automatically.
To resolve this problem we need to configure the application target to build the static library target
and
we need to configure the application target to link to the static library target.

Resources