objective-c – SoundCloud API Apple Mach-O链接器(Id)错误

前端之家收集整理的这篇文章主要介绍了objective-c – SoundCloud API Apple Mach-O链接器(Id)错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试将 Cocoa SoundCloud API集成到我的iPhone / iPad应用程序中.我按照 here详细说明进行操作,但是当我尝试构建并运行我的项目时,出现以下错误

Apple Mach-O链接器(Id)错误

Ld "/Users/curuser/Library/Developer/Xcode/DerivedData/MyApp-gzdzxolteaojcobbqsfkgxakkclz/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp" normal i386
    cd "/Users/curuser/DropBox/iPhone Apps/MyApp"
    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/curuser/Library/Developer/Xcode/DerivedData/MyApp-gzdzxolteaojcobbqsfkgxakkclz/Build/Products/Debug-iphonesimulator -F/Users/curuser/Library/Developer/Xcode/DerivedData/MyApp-gzdzxolteaojcobbqsfkgxakkclz/Build/Products/Debug-iphonesimulator -filelist "/Users/curuser/Library/Developer/Xcode/DerivedData/MyApp-gzdzxolteaojcobbqsfkgxakkclz/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -all_load -ObjC -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_required=30000 -framework UIKit /Users/curuser/Library/Developer/Xcode/DerivedData/MyApp-gzdzxolteaojcobbqsfkgxakkclz/Build/Products/Debug-iphonesimulator/SoundCloudAPI/SoundCloudAPI -framework Security -framework OAuth2Client /Users/curuser/Library/Developer/Xcode/DerivedData/MyApp-gzdzxolteaojcobbqsfkgxakkclz/Build/Products/Debug-iphonesimulator/libSoundCloudAPI.a -lOAuth2Client -framework AudioToolBox -framework Foundation -o "/Users/curuser/Library/Developer/Xcode/DerivedData/MyApp-gzdzxolteaojcobbqsfkgxakkclz/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp"

Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang Failed with exit code 1

我对iPhone开发很新,我无法弄清楚如何修复它.我的猜测是我错过了一个框架,但我添加了步骤#3中所述的框架:

>现在,Target需要了解它应链接的新库.因此,在项目中,选择Target,然后在Build Phases中转到Link Binary with Libraries部分.添加以下内容

> libSoundCloudAPI.a(或桌面上的SoundCloudAPI.framework)
> libOAuth2Client.a(或桌面上的OAuth2Client.framework)
> Security.framework
> AudioToolBox.framework(如果你想要流媒体)

当我添加libSoundCloudAPI.a和libOAuth2Client.a时,它会显示为工作区中的缺失文件(带有虚线边框图标的红色).

解决方法

如果您不熟悉iOS开发,将SoundCloud集成到App中的最佳方法是使用新的 CocoaSoundCloudAPI.SoundCloud不再支持您所指的那个.

要将其集成到您的项目中,您只需要以下几个步骤:

在终端

>转到项目目录.
>添加所需的GIT子模块

// For the API
git submodule add git://github.com/nxtbgthng/OAuth2Client.git
git submodule add git://github.com/soundcloud/CocoaSoundCloudAPI.git
git submodule add git://github.com/nxtbgthng/JSONKit.git
git submodule add git://github.com/nxtbgthng/OHAttributedLabel.git
git submodule add git://github.com/soundcloud/CocoaSoundCloudUI.git

在Xcode中

>创建一个包含上面添加的所有子模块的工作区.
>为了能够找到标题,您仍需要将../**(或./**,具体取决于您的设置)添加到主项目的标题搜索路径中.
>现在,然后在Build Phases中转到Link Binary with Libraries部分.添加以下内容

> libSoundCloudAPI.a
> libOAuth2Client.a
> libJSONKit.a
> libOHAttributedLabel.a
> libSoundCloudUI.a
> QuartzCore.framework
> AddressBook.framework
> AddressBookUI.framework
> CoreLocation.framework
> Security.framework
> CoreGraphics.framework
> CoreText.framework

>下一步是确保链接器找到所需的一切:所以转到项目的Build设置并将以下内容添加到Other Linker Flags

-all_load -ObjC

>在iOS上我们需要一些图形:请将SoundCloud.bundle从CocoaSoundCloudUI /目录移动到您的资源.

猜你在找的Xcode相关文章