19

I am struggling with linking ALAssetsLibrary in my code.

I have googled a lot on this and followed more than one tutorial to the last dot yet I am still where I began.

Ld /Users/vedprakash/Library/Developer/Xcode/DerivedData/PickThumb-gmvprlkgmgexedeojbaoeidbadnw/Build/Products/Debug-iphonesimulator/PickThumb.app/PickThumb normal i386
    cd "/Users/vedprakash/Documents/XCode Projects/PickThumb"
    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/vedprakash/Library/Developer/Xcode/DerivedData/PickThumb-gmvprlkgmgexedeojbaoeidbadnw/Build/Products/Debug-iphonesimulator -F/Users/vedprakash/Library/Developer/Xcode/DerivedData/PickThumb-gmvprlkgmgexedeojbaoeidbadnw/Build/Products/Debug-iphonesimulator -filelist /Users/vedprakash/Library/Developer/Xcode/DerivedData/PickThumb-gmvprlkgmgexedeojbaoeidbadnw/Build/Intermediates/PickThumb.build/Debug-iphonesimulator/PickThumb.build/Objects-normal/i386/PickThumb.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/vedprakash/Library/Developer/Xcode/DerivedData/PickThumb-gmvprlkgmgexedeojbaoeidbadnw/Build/Products/Debug-iphonesimulator/PickThumb.app/PickThumb

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_ALAssetsLibrary", referenced from:
      objc-class-ref in PickThumbViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Jason Sturges
  • 15,635
  • 14
  • 56
  • 75
nirvana74v
  • 961
  • 2
  • 15
  • 22

2 Answers2

38

You need to add the AssetsLibrary framework to the “Link Binary With Libraries” build phase of your PickThumb target.

How to "add existing frameworks" in Xcode 4?

Community
  • 1
  • 1
rob mayoff
  • 342,380
  • 53
  • 730
  • 766
  • After adding I am receiving this error: `ld: warning: ignoring file /Users/vedprakash/Documents/XCode Projects/PickThumb/AssetsLibrary.framework/AssetsLibrary, file was built for unsupported file format which is not the architecture being linked (i386)` – nirvana74v Jun 23 '12 at 20:20
  • That is not the correct location for the `AssetsLibrary` framework. I don't think you followed the directions in the link. – rob mayoff Jun 23 '12 at 20:28
  • I have added the framework as it is in the link and the library shows up in the list under "Link Binary with Libraries" – nirvana74v Jun 23 '12 at 20:36
  • The link command should say `-framework AssetsLibrary` if you added it correctly. It should not have a path that ends with `/AssetsLibrary`. – rob mayoff Jun 23 '12 at 20:38
  • Thanks Rob :). I removed and added the library and it build successfully. – nirvana74v Jun 23 '12 at 20:40
7

In Xcode 10.2 I just added

AssetsLibrary.framework

in the Target>Build Phases> Link Binary With Libraries section

TMin
  • 2,009
  • 1
  • 23
  • 32