无法链接 ALAssetsLibrary

Posted

技术标签:

【中文标题】无法链接 ALAssetsLibrary【英文标题】:Unable to link ALAssetsLibrary 【发布时间】:2012-06-23 20:10:06 【问题描述】:

我正在努力在我的代码中链接 ALAssetsLibrary。

我对此进行了很多谷歌搜索,并遵循了不止一个教程到最后一个点,但我仍然是我开始的地方。

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)

【问题讨论】:

【参考方案1】:

您需要将AssetsLibrary 框架添加到PickThumb 目标的“Link Binary With Libraries”构建阶段。

How to "add existing frameworks" in Xcode 4?

【讨论】:

添加后我收到此错误: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) 这不是AssetsLibrary 框架的正确位置。我认为您没有按照链接中的说明进行操作。 我已经在链接中添加了框架,并且该库显示在“Link Binary with Libraries”下的列表中 如果你正确添加了链接命令,它应该是-framework AssetsLibrary。它不应该有以/AssetsLibrary 结尾的路径。 谢谢罗伯:)。我删除并添加了库并成功构建。【参考方案2】:

我刚刚在 Xcode 10.2 中添加了

AssetsLibrary.framework

在 Target>Build Phases> Link Binary With Libraries 部分

【讨论】:

以上是关于无法链接 ALAssetsLibrary的主要内容,如果未能解决你的问题,请参考以下文章

无法启动“软件更新程序”:无法执行子进程/usr/bin/update-manager(符号链接链接级别太多)[关闭]

无法定位程序输入点 于动态链接库上怎么解决

VC中使用openGL链接显示 无法解析的外部符号

VC中使用openGL链接显示 无法解析的外部符号

无法定位序数4444于动态链接库libcurl.dll应当如何解决?

为啥链接器无法识别我的链接器脚本中定义的入口点