SoundCloud API 苹果 Mach-O 链接器(Id)错误

4
我正在尝试将Cocoa SoundCloud API集成到我的iPhone / iPad应用程序中。 我已经按照这里详细说明的说明进行操作,但是当我尝试构建和运行我的项目时,我会收到以下错误消息: 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需要知道它应该链接的新库。所以在项目中,选择目标,在Build Phases中转到Link Binary with Libraries部分。添加以下内容:

    • libSoundCloudAPI.a(或桌面上的SoundCloudAPI.framework)
    • libOAuth2Client.a(或桌面上的OAuth2Client.framework)
    • Security.framework
    • AudioToolbox.framework(如果您想要流式传输)

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


你遇到了同样的问题...你找到解决方法了吗? - Lior Frenkel
不,我只是重新执行了所有步骤,然后就可以了。最终,我甚至没有再使用SoundCloud的API,而是使用AVAudioQueuePlayer来从SoundCloud流式传输。 - dpactri
1个回答

1

如果你是iOS开发的新手,将SoundCloud集成到你的应用程序中的最佳方法是使用新的CocoaSoundCloudAPI。你所提到的那个已经不再受SoundCloud支持。

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

在终端中执行以下操作:

  1. 进入您的项目目录。

  2. 添加所需的GIT子模块

    // 对于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中

  1. 创建一个工作区,其中包含上面添加的所有子模块。

  2. 为了能够找到头文件,您仍然需要将../**(或./**,具体取决于您的设置)添加到主项目的Header Search Path中。

  3. 现在,目标需要知道它应该链接的新库。因此,在项目中,选择目标,并在构建阶段中转到链接二进制文件与库部分。添加以下内容:

    • libSoundCloudAPI.a
    • libOAuth2Client.a
    • libJSONKit.a
    • libOHAttributedLabel.a
    • libSoundCloudUI.a
    • QuartzCore.framework
    • AddressBook.framework
    • AddressBookUI.framework
    • CoreLocation.framework
    • Security.framework
    • CoreGraphics.framework
    • CoreText.framework
  4. 下一步是确保链接器找到其所需的所有内容:因此,请转到项目的构建设置,并将以下内容添加到其他链接器标志

    -all_load -ObjC
    
  5. 在iOS上,我们需要一些图形:请将CocoaSoundCloudUI/目录中的SoundCloud.bundle移动到您的资源中。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接