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 中所述的框架:

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

    • libSoundCloudAPI.a(或桌面上的 SoundCloudAPI.framework)
    • libOAuth2Client.a(或桌面上的 OAuth2Client.framework)
    • 安全框架
    • AudioToolbox.framework(如果你想流式传输)

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

4

1 回答 1

1

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

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

在终端

  1. 转到您的项目目录。

  2. 添加所需的 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 中

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

  2. 为了能够找到标题,您仍然需要添加../**(或./**取决于您的设置)到Header Search Path主项目的。

  3. 现在目标需要知道它应该链接的新库。因此,在Project中,选择Target,然后在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
  4. 下一步是确保链接器找到它需要的一切:所以转到项目的构建设置并将以下内容添加到其他链接器标志

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

于 2012-03-22T10:11:56.550 回答