4

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)
Omer Waqas Khan
  • 2,423
  • 4
  • 33
  • 62
  • Have you two classes with same name i.e.:- Asset ? – Ali3n Jan 17 '12 at 12:39
  • hey you are right, there were 2 classes with the same name but now when I have deleted those files, I am getting 2 errors, please check the question I have edited it – Omer Waqas Khan Jan 17 '12 at 12:45

4 Answers4

10

Please include coreData framework ...

Ali3n
  • 1,244
  • 6
  • 10
0

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:

  1. In the project navigator, select your project
  2. Select your target
  3. Select the 'Build Phases' tab
  4. Open 'Link Binaries With Libraries' expander
  5. Click the '+' button
  6. Select your framework
  7. (optional) Drag and drop the added framework to the 'Frameworks' group

enter image description here

Link to the original post: How to "add existing frameworks" in Xcode 4?

Community
  • 1
  • 1
Oxon
  • 4,901
  • 8
  • 40
  • 54
0

I got the linker error because I only imported the "human" files into my project and not the "machine" files.

DIJ
  • 347
  • 4
  • 19
0

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

Novarg
  • 7,390
  • 3
  • 38
  • 74