Xcode 4.3.1 import files to new project - iphone

I accidentaly remove target in my previews project and i decided to create new one and import files. I added all frameworks and copy my AppDelegate files. When i build project i have this error.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AppDelegate", referenced from:
objc-class-ref in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help..

Check in your target's build phases that the AppDelegate.m is in the Compile Sources and the AppDelegate.h is in the Copy Headers Section

Make sure all .m files (specifically AppDelegate) are included in the target membership. (check box under file inspector when class is selected)

Related

Compiling with objective-c file in Swift project

I am working with a framework that is using the Obfuscate. The framework is using a header file to do the obfuscate.
E.g file :
#define funcOne JJmYVBhJqZYKCTJJrEsEr
#define funcTwo zKqquIfbcRKqMhPXl
#define funcThree pDeUyAXpAircdITBKBZacBzgCyIL
#define funcFour SUjJeKmteuaFbcZzg
To run this under the "Build Settings" the "Other C Flags" and "Other C++ Flags" added the header file "ExternalObfuscate.h"
By doing this the projects in Objective-c work well.
But the problem is that I am using project in swift.
The steps that I did to add the framework to the Swift project was:
I add the "Bridging-Header" and add the header file
#import "ExternalObfuscate.h"
And also add the location to "Other C Flags" and "Other C++ Flags"
That didn't work, so I decide to copy all the defines to the "Bridging-Header" that didn't work also.
The error that I have all the time is
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_funcOne", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Currently have no ideas of what I can do to resolve this, does anyone have any suggestions?

ignoring file [path] missing required architecture i386 in file

I'm quite new to Xcode and Iphone development and ran into the following problem:
I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor).
I get the following warning:
ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)
If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:
ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", 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've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.
More info:
I'm Using Xcode 4.6.1
The files are currently located at project's root folder.
I'm using a Single View Application tamplate.
Appreciate any help
This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).
You can use this terminal command to create a universal library:
lipo -create lib_arm.a lib_i386.a -output lib_universal.a
More info about lipo command here.
Change your target's "Build Settings > Build Active Architectures Only" to "No"
This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.
If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.

Xcode 4.3.3 missing SenTestingKet.framework causes Undefined symbols "_OBJC_METACLASS_$_SenTestCase"

On my MAC mini osx-snow-leopard xcode4.1 my project can run SenTestingKit.framework tests. Got a MACBook Pro with osx-lion 10.7.4 with xcode4.3. For the same project I cannot run unit tests because SenTestingKit.framework is not to be found. I copy sentestingkit from the Mac mini to "/Applications/Xcode.app/Contents/Developer/Library/Frameworks". Add to each target Framework Search Paths:
$(inherited)
"$(DEVELOPER_LIBRARY_DIR)/Frameworks"
This resolves to "/Applications/Xcode.app/Contents/Developer/Library/Frameworks".
I can add sentestingkit to the project so it compiles. I can't run Product > Test because of this link error undefined-symbol:
Undefined symbols for architecture i386:
"_OBJC_METACLASS_$_SenTestCase", referenced from:
_OBJC_METACLASS_$_Field_MobileApplicationTests in Field_MobileApplicationTests.o
"_OBJC_CLASS_$_SenTestCase", referenced from:
_OBJC_CLASS_$_Field_MobileApplicationTests in Field_MobileApplicationTests.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
I had the same problem by using my class that want to be tested. I got this error:
Undefined symbols for architecture i386:
"_OBJC_METACLASS_$_JsonDictParser", referenced from:
_OBJC_METACLASS_$_MainData in MainData.o
_OBJC_METACLASS_$_JsonObjectClass in JsonObjectClass.o
"_OBJC_CLASS_$_JsonDictParser", referenced from:
_OBJC_CLASS_$_MainData in MainData.o
_OBJC_CLASS_$_JsonObjectClass in JsonObjectClass.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 created an object from my class that I want to test and forgot to tell the „Target Membership“. So I make sure I checked the test class.
E.g. I want to use JsonDictParser class for testing in my JsonTestLogicTest class. So I focus the JsonDictParser.m file, clicked the File Inspector at the right side on the main window, selected Target Membership and checked my class where my testcases are in JsonTestLogicTest.
Or open the .xcodeproject file in the Project Navigator, select the target with the test methods > Build Phases > Compile Sources and add the .m file which includes your classs that you want to test.

Linker command failed with exit code 1 - not sure why

I'm not sure exactly why i'm getting this. It usually comes because of a missing framework, except its mentioning a class I already have in my project, and imported into the file it's saying the error is on. It says...
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ELCImagePickerController", referenced from:
objc-class-ref in JCreateViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
JCreateViewController.m had this in the imports:
#import "ELCImagePickerController.h"
So i don't really know why it's giving me this error.
Any ideas?
In the interest of providing an acceptable answer, from the comments:
Make sure ELCImagePickerController is included in your project's Compile Sources build phase.
you can add resources to your projects build phases by simple select and add see this link

AQGridView not linking

I am trying to use the AQGridView in an app. I copied all the files into my project but I keep getting the error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AQGridView", referenced from:
objc-class-ref in GridViewController.o
"_OBJC_CLASS_$_AQGridViewCell", referenced from:
_OBJC_CLASS_$_GridViewCell in GridViewCell.o
"_OBJC_METACLASS_$_AQGridViewCell", referenced from:
_OBJC_METACLASS_$_GridViewCell in GridViewCell.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What am I doing wrong? I have all the necessary files added
Remove all the AQGridView files from your project and then add them again, but make sure when adding the Add to targets checkbox before your build target is checked. It seems that the files are added correctly, but not properly linked to your target.