I have started adding core data to my application. I created the entity with name Assets and defined its four attributes and then created Asset.h and Asset.m file for NSManagedObject. Now I am getting the following error while before that my application was working fine
Ld /Users/Omer/Library/Developer/Xcode/DerivedData/LoginTest-enoqygjnncuapjescysdafbighag/Build/Products/Debug-iphonesimulator/LoginTest.app/LoginTest normal i386
cd /Users/Omer/Desktop/Docs/LoginTest
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/Omer/Library/Developer/Xcode/DerivedData/LoginTest-enoqygjnncuapjescysdafbighag/Build/Products/Debug-iphonesimulator -L/Users/Omer/Desktop/Docs/LoginTest/ZBarSDK -F/Users/Omer/Library/Developer/Xcode/DerivedData/LoginTest-enoqygjnncuapjescysdafbighag/Build/Products/Debug-iphonesimulator -filelist /Users/Omer/Library/Developer/Xcode/DerivedData/LoginTest-enoqygjnncuapjescysdafbighag/Build/Intermediates/LoginTest.build/Debug-iphonesimulator/LoginTest.build/Objects-normal/i386/LoginTest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -liconv -framework QuartzCore -framework CoreVideo -framework CoreMedia -framework AVFoundation -framework MapKit -framework CoreLocation -lz -framework CoreGraphics -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework Foundation -framework UIKit -lzbar -o /Users/Omer/Library/Developer/Xcode/DerivedData/LoginTest-enoqygjnncuapjescysdafbighag/Build/Products/Debug-iphonesimulator/LoginTest.app/LoginTest
Undefined symbols for architecture i386:
"_OBJC_METACLASS_$_NSManagedObject", referenced from:
_OBJC_METACLASS_$_Asset in Asset.o
"_OBJC_CLASS_$_NSManagedObject", referenced from:
_OBJC_CLASS_$_Asset in Asset.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please include coreData framework ...
I wouldn't create these classes myself. I"d recommend you to delete them and use mogenerator to do it for you. It will create 4 classes for each entity. In your example it would be:
_Assets.h
_Assets.m
Assets.h
Assets.m
don't touch the _Assets.h and _Assets.m files, do all what you need in Assets.h and Assets.m.
Hope it helps
Add Core Data
You need to add core data framework as suggested by Ali3n.
How To Add A Framework
If you don't know how to add a framework to your project do the following:
In the project navigator, select your project
Select your target
Select the 'Build Phases' tab
Open 'Link Binaries With Libraries' expander
Click the '+' button
Select your framework
(optional) Drag and drop the added framework to the 'Frameworks' group
Link to the original post: How to "add existing frameworks" in Xcode 4?
I got the linker error because I only imported the "human" files into my project and not the "machine" files.
Related
Full error message:
Ld/Users/chairman/Library/Developer/Xcode/DerivedData/Field_Final-dsxytmugnwuntcglfimizlbtmegi/Build/Products/Debug-iphonesimulator/Field_Final.app/Field_Final normal i386
cd "/Users/chairman/Documents/Vitthal/NEWFSNOV21_2.3/FSDEVICE2.3 dec6/Field_Final"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Users/chairman/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Users/chairman/Desktop/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Users/chairman/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Users/chairman/Desktop/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/chairman/Library/Developer/Xcode/DerivedData/Field_Final-dsxytmugnwuntcglfimizlbtmegi/Build/Products/Debug-iphonesimulator -F/Users/chairman/Library/Developer/Xcode/DerivedData/Field_Final-dsxytmugnwuntcglfimizlbtmegi/Build/Products/Debug-iphonesimulator -filelist /Users/chairman/Library/Developer/Xcode/DerivedData/Field_Final-dsxytmugnwuntcglfimizlbtmegi/Build/Intermediates/Field_Final.build/Debug-iphonesimulator/Field_Final.build/Objects-normal/i386/Field_Final.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Objc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework MapKit -framework CoreLocation -lz.1.2.5 -lstdc++.6 -licucore.A -framework AddressBook -framework CoreFoundation -framework CFNetwork -framework Security -framework MobileCoreServices -framework SystemConfiguration -framework MessageUI -framework UIKit -framework Foundation -framework CoreGraphics -lAfariaSLL -lMAKit -lsupUltralite -lsupcore -lSUPObj -lclientrt -lDatavault -lMO -o /Users/chairman/Library/Developer/Xcode/DerivedData/Field_Final-dsxytmugnwuntcglfimizlbtmegi/Build/Products/Debug-iphonesimulator/Field_Final.app/Field_Final
ld: library not found for -lAfariaSLL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Go to your target. Under build settings, search for "library search paths". There you should list all the directories where your linked libraries are located.
In respect to SUP, read here about the project settings: http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01213.0225/doc/html/aro1369255660920.html. The link is for v2.2.5, you can select on the left your version and find the document there.
Try this :
Go to targets -> Build phases -> Link Binary With Libraries
Click on + symbol
Press Add Other & add your library
Clean project & than run
I don't understand my error:
Ld
Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/Test.app/Test
normal i386
cd /Users/lol/Desktop/Test
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2
-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk
-L/Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator
-L/Users/lol/Desktop/Test -F/Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator
-filelist /Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Intermediates/Test.build/Debug-iphonesimulator/Test.build/Objects-normal/i386/Test.LinkFileList
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -lextThree20JSON+SBJSON /Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/libThree20UICommon.a
/Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/libThree20.a
/Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/libThree20UINavigator.a
/Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/libThree20Core.a
/Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/libThree20UI.a
/Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/libThree20Network.a
/Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/libThree20Style.a
-framework SystemConfiguration -framework MobileCoreServices -framework CFNetwork -framework AddressBook -framework AddressBookUI -framework QuartzCore -framework UIKit -framework Foundation -framework MessageUI -framework CoreGraphics -lz.1.2.3 -lxml2.2.7.3 -o /Users/lol/Library/Developer/Xcode/DerivedData/Test-aywxyvnakaqhmwfbwellynwqmoik/Build/Products/Debug-iphonesimulator/Test.app/Test
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
Can you help me to understand this?
Thanks a lot ;)
The option -lz.1.2.3 means that the compiler is attempting to link the file libz.1.2.3.a, libz.1.2.3.so, or libz.1.2.3.dylib. It cannot find any of these variations and is failing because of that.
You can attempt to find the location of this file and include it in your library include path.
My question is why are you linking a specific version of z lib? Usually, it's good enough to just have -lz or -llibz.dylib. Do you have a reason for picking a specific version? What happens when you link using the un-versioned name.
Just use -lz, there's no need to use the versioned link to it. So remove libz-1.2.3.tbd from frameworks and add libz.tbd.
In the project navigator, select your project.
Select your target.
Select the "Build Phases" tab.
Open "Link Binaries With Libraries" expander.
Remove libz-1.2.3.tbd
Click the + button.
Add libz.tbd
I'm trying to create a project utilizing both MailChimp and ShareKit code.
I believe I'm dynamically linking to them both by dragging their Xcode project files into my new project, then dragging and dropping the desired groups.
The problem I'm having now is that they both use a file name called SBJSonParser from their JSON libraries.
I'm getting an error that says:
ld: duplicate symbol _OBJC_CLASS_$_SBJsonParser
I don't want / don't think renaming the files would be sufficient, as there are quite a few more filenames they have in common. Does anyone have ideas on what to do? Thanks
Full error:
Ld /Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Products/Debug-iphonesimulator/PolaroidMe.app/PolaroidMe normal i386
cd /Users/user/Documents/PolaroidMe
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Products/Debug-iphonesimulator -F/Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Products/Debug-iphonesimulator -filelist /Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Intermediates/PolaroidMe.build/Debug-iphonesimulator/PolaroidMe.build/Objects-normal/i386/PolaroidMe.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework CoreLocation -framework Twitter -framework CFNetwork -framework SystemConfiguration -framework Security -framework MessageUI -framework AVFoundation -framework MobileCoreServices -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Products/Debug-iphonesimulator/PolaroidMe.app/PolaroidMe
ld: duplicate symbol _OBJC_CLASS_$_SBJsonParser in /Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Intermediates/PolaroidMe.build/Debug-iphonesimulator/PolaroidMe.build/Objects-normal/i386/SBJsonParser-7C0C46CE63D45CA3.o and /Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Intermediates/PolaroidMe.build/Debug-iphonesimulator/PolaroidMe.build/Objects-normal/i386/SBJsonParser-227BA1E6AFC01E91.o for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
ld: duplicate symbol _OBJC_CLASS_$_SBJsonParser in /Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Intermediates/PolaroidMe.build/Debug-iphonesimulator/PolaroidMe.build/Objects-normal/i386/SBJsonParser-7C0C46CE63D45CA3.o and /Users/user/Library/Developer/Xcode/DerivedData/PolaroidMe-gvmchgayobqfebhcnhfwhxoueaeo/Build/Intermediates/PolaroidMe.build/Debug-iphonesimulator/PolaroidMe.build/Objects-normal/i386/SBJsonParser-227BA1E6AFC01E91.o for architecture i386
SBJSON is a library, it only needs to be inside your project once. Just delete one of them.
I am getting Apple Mach-O Linker Id error, while compiling the iphone app. And getting below error
Ld
"/Users/adminbluepal/Library/Developer/Xcode/DerivedData/Tiger-czyksblsmfqdqybamuutemvjbdek/Build/Products/Debug-iphonesimulator/Tiger
Dev.app/Tiger Dev" normal i386
cd /Users/adminbluepal/Desktop/Dir-Tiger_latest
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2
-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk
-L/Users/adminbluepal/Library/Developer/Xcode/DerivedData/Tiger-czyksblsmfqdqybamuutemvjbdek/Build/Products/Debug-iphonesimulator
-F/Users/adminbluepal/Library/Developer/Xcode/DerivedData/Tiger-czyksblsmfqdqybamuutemvjbdek/Build/Products/Debug-iphonesimulator
-filelist "/Users/adminbluepal/Library/Developer/Xcode/DerivedData/Tiger-czyksblsmfqdqybamuutemvjbdek/Build/Intermediates/Tiger.build/Debug-iphonesimulator/Tiger.build/Objects-normal/i386/Tiger
Dev.LinkFileList" -Xlinker
--no-demangle -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -liLibs -framework AVFoundation -framework AudioToolbox -framework CoreMedia
-framework Foundation -framework GameKit -framework OpenGLES -framework
QuartzCore -framework Security
-framework SystemConfiguration -framework UIKit -lz -o "/Users/adminbluepal/Library/Developer/Xcode/DerivedData/Tiger-czyksblsmfqdqybamuutemvjbdek/Build/Products/Debug-iphonesimulator/Tiger
Dev.app/Tiger Dev"
ld: library not found for -liLibs
collect2: ld returned 1 exit status
Command
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2
failed with exit code 1
Please help me out of this
Thank you,
Madan Mohan
Yesterday i had this problem.... cleared that error with the help of this answer. it may help you also...
You probably don't have the CoreGraphics.framework added to your frameworks list.
To make sure, click the "Frameworks" folder on Xcode. If the framework isn't listed on the table to the right, you'll need to add it by right-clicking the Frameworks folder, chooseing "Add Existing Framework..." and then choosing it from the list.
Source stack overflow previous question
Sounds like you're trying to use the iLibs library (Google says it's something for game development). XCode cannot properly link to it. Try adding their Framework to your project, or read the help docs of the library for help with its setup. Alternatively, see if you can remove the "-liLibs" linker flag in your build settings, if you aren't using the library.
Being new to iPhone development I was wanting to take it to the next level and use the Three20 library for a photo gallery I am building.
http://www.raywenderlich.com/1430/how-to-use-the-three20-photo-viewer
Everything seemed to go smoothly up to the point I tried testing the app and I got this error.
"_OBJC_METACLASS_$_TTURLRequestModel", referenced from:
Ld build/Debug-iphonesimulator/PhotoGallery.app/PhotoGallery normal i386
cd /Users/company/Documents/PhotoGallery
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk -L/Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator -F/Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator -filelist /Users/company/Documents/PhotoGallery/build/PhotoGallery.build/Debug-iphonesimulator/PhotoGallery.build/Objects-normal/i386/PhotoGallery.LinkFileList -mmacosx-version-min=10.6 -ObjC -all_load -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -framework CFNetwork -framework SystemConfiguration -framework MobileCoreServices -lz.1.2.3 -framework CoreLocation -framework QuartzCore /Users/company/Documents/opensource/three20/Build/Products/Debug-iphonesimulator/libThree20.a -framework CoreData -o /Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator/PhotoGallery.app/PhotoGallery
Undefined symbols:
"_OBJC_METACLASS_$_TTURLRequestModel", referenced from:
_OBJC_METACLASS_$_PhotoSet in PhotoSet.o
"_OBJC_CLASS_$_TTURLRequestModel", referenced from:
_OBJC_CLASS_$_PhotoSet in PhotoSet.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Anyone
While I included the Three20 static library I didn't include the other dependencies in the same library such as Three20UINavigator.xcodeproj etc.
Sudo was pretty close. While I did include the proper libraries it was simply that they were not activated; I don't know the proper term :P
Basically, we should keep in mind that just because I dragged the Three20.xcodeproj into my project doesn't suffice when other extensions are needed as well. Simply drag all of the xcodeproj files necessary in (wherever you are keeping three20)/three20/src/(name of particular extension)/(name of particular file).xcodeproj into your projects "group and files" Then click on each extension and select the (name of particular file).a and check the checkbox on the far right of the file preview section. This is what I didn't do for all the extensions that seemed to resolve the problem even though I had previously included them all.