dpactri
dpactri

Reputation: 351

SoundCloud API Apple Mach-O Linker (Id) Error

I'm trying to integrate the Cocoa SoundCloud API into my iPhone/iPad app. I've followed the instructions detailed here but when I try to Build and Run my project, I get the following error:

Apple Mach-O Linker (Id) Error

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

I'm quite new to iPhone development, and I can't figure out how to fix it. My guess is that I'm missing a framework, but I've added the frameworks as stated in step #3:

When I add libSoundCloudAPI.a and libOAuth2Client.a though, it shows up as a missing file from workspace (red with the dotted border icon).

Upvotes: 4

Views: 1458

Answers (1)

Tobias Kräntzer
Tobias Kräntzer

Reputation: 1714

If you are new to iOS development, the best way to integrate SoundCloud into you App is by using the new CocoaSoundCloudAPI. The one that you are referring to is not longer supported by SoundCloud.

To integrate this into you project you just need these few steps:

In the Terminal

  1. Go to your project directory.

  2. Add the required GIT Submodules

    // 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
    

In Xcode

  1. Create a Workspace containing all those submodules added above.

  2. To be able to find the Headers, you still need to add ../** (or ./** depending on your setup) to the Header Search Path of the main project.

  3. Now the Target needs to know about the new libraries it should link against. So in the Project, select the Target, and in Build Phases go to the Link Binary with Libraries section. Add the following:

    • 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. Next step is to make sure that the Linker finds everything it needs: So go to the Build settings of the project and add the following to Other Linker Flags

    -all_load -ObjC
    
  5. On iOS we need a few graphics: Please move the SoundCloud.bundle from the CocoaSoundCloudUI/ directory to your Resources.

Upvotes: 1

Related Questions