0

I am trying to use restkit with cocoapods and rubymotion, and just cant get a simple get request to work. I can see on my rails app logs that the simulator request is getting there, but restkit never calls its callback. Worse is, I dont get any error messages most of the time, and if I am lucky all I get is this one;

Command failed with status (1): [DYLD_FRAMEWORK_PATH="/Applications/Xcode.a...]

Which in the end tells me nothing. Here is the code I am performing:

class GameManager

  attr_accessor :games, :delegate

  def load_games
    RKClient.sharedClient.get("/games.json", delegate:self)
  end

  def objectLoader(objectLoader, didLoadObjects:objects)
    puts "Objects: #{objects}"
  end

  def objectLoader(objectLoader, didFailWithError:failError)
    puts "Error: #{failError}"
  end

  def request(request, didLoadResponse:response)
    if request.isGET
      if response.isOK
        puts response.bodyAsString
      else
        puts response.inspect
      end
    end
  end

end

Any help would be great with this

marcelorocks
  • 2,005
  • 3
  • 18
  • 28

1 Answers1

0

To use those RKObjectLoaderDelegate callbacks, you'll want to issue the request using an instance of RKObjectManager: http://restkit.org/api/master/Classes/RKObjectManager.html

RKClient is the lower-level interface for handling HTTP requests, and calls a different set of callbacks via the RKRequestDelegate protocol: http://restkit.org/api/master/Protocols/RKRequestDelegate.html

RKObjectManager instances use an RKClient to issue requests under the hood, though, so if you use an instance of RKObjectManager you can have its delegate (your GameManager instance) implement both protocols, and then both protocol's callbacks will fire.