Questions tagged [restkit]

RestKit is an Objective-C framework for iOS that aims to make interacting with RESTful web services simple, fast and fun. It combines a clean, simple HTTP request/response API with a powerful object mapping system that reduces the amount of code you need to write to get stuff done.

A simple, high level HTTP request / response system.

RestKit ships with an HTTP client built on top of NSURLConnection and provides a library of helpful methods for inspecting MIME types and status codes. Submitting form data is as simple as providing a dictionary of parameters and a native params object is included for easily creating multi-part submissions.

Core Data support.

Building on top of the object mapping layer, RestKit provides integration with Apple’s Core Data framework. This support allows RestKit to persist remotely loaded objects directly back into a local store, either as a fast local cache or a primary data store that is periodically synced with the cloud. RestKit can populate Core Data associations for you, allowing natural property based traversal of your data model. It also provides a nice API on top of the Core Data primitives that simplifies configuration and querying use cases.

Database Seeding.

When the Core Data object store is used, you can seed a database from a collection of data files. This lets you submit your apps to the App Store with a database in the app bundle that is ready for immediate use.

Framework level support for switching servers & environments (development/production/staging).

RestKit uses a base URL and resource paths rather than full URL’s to allow you to switch target servers quickly. Interpolating URL strings and constructing NSURL objects is a thing of the past.

An object mapping system.

RestKit provides a modeling layer for mapping processed data payloads into native Cocoa objects declaratively. This lets the application programmer stop worrying about parsing and simply ask the framework to asynchronously fetch a remote resource and call the delegate with the results. Object mapping is implemented using key-value coding, allowing for quick traversal of the parsed object graph. Reflection is used on the property types to allow for mapping from remote dates encoded as a string back to NSDate objects.

Pluggable parsing layer.

RestKit currently supports JSON via the SBJSON and YAJL parsers. Parsing is implemented behind a simple interface to allow additional data formats to be handled transparently.

References

2699 questions
13
votes
2 answers

RestKit OAuth 2 Password Authentication Flow

I am using RestKit with an own OAuth2 Provider. I try to authenticate via Resource Owner Password Credentials. Could anyone provide some example code and best practices for requesting protected resources via RestKit in general and authenticating via…
pex
  • 7,351
  • 4
  • 32
  • 41
13
votes
1 answer

Rails and iOS app, authentication question

I want to build web service in Rails 3 and iOS app to work with this service. I need simple thing. User when first time open iOS app, get login screen. When is logged in, iOS app can send and get requests. I already used Devise for authentication on…
dormitkon
  • 2,526
  • 4
  • 39
  • 60
13
votes
5 answers

More than one RKObjectManager at a time (RestKit)

I am testing out RestKit and need to access different BaseUrls and also sometimes access a web service with the same baseUrl from different places "at once", lastly I also need to access the same baseUrl with different ressourcePaths in the same…
RickiG
  • 11,380
  • 13
  • 81
  • 120
13
votes
5 answers

RestKit ios - put - json instead of form encoded

i am writing an ios app that uses restkit to communicate with a web server through Rest with JSON i am able to use [[RKObjectManager sharedManager] loadObjectsAtResourcePath:path delegate:self] to get object from my web service as JSON, map it to…
goane
  • 311
  • 1
  • 3
  • 6
13
votes
3 answers

is it possible to install AFNetworking 2.0 with Restkit

I got an news app which fetches news online in XML format in stores it locally in the sqlite dbase.. which is perfect case for restkit. However, I would like to also fetch xml data manually sometimes (ie and not want to store it in the dbase).. in…
abbood
  • 23,101
  • 16
  • 132
  • 246
12
votes
1 answer

iOS RestKit can not save local entity to database

I am using RestKit 0.20 to parse JSON data and save to database. THere is a mapped entity SchoolClass, which is handled by RestKit and saves fine. I have another entity called MyClass, which stores the classes I have selected. This one is only local…
Ray
  • 16,025
  • 5
  • 31
  • 51
12
votes
2 answers

Access Response Data in Success callback

Is there any way to access the response data in the success block for a request using the object manager? [objectManager postObject:[User class] path:@"/users" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult…
fzf
  • 931
  • 1
  • 9
  • 19
12
votes
3 answers

iOS background Location not sending http request

My app needs to track the users location in the background but it is failing to send a 'get' request. The http request gets sent immediately when the app comes to the foreground. I am using RestKit for all my network requests and I followed this…
Kyle C
  • 4,077
  • 2
  • 31
  • 34
12
votes
1 answer

RestKit Object Mapping relationships with foreign keys

Can RestKit connect a relationship without storing the foreign key as an attribute, i.e., directly from the keypath in the JSON? In particular, I've got a Job has_many Rooms relationship. The room's JSON doesn't contain the job, rather, both are…
Zeophlite
  • 1,607
  • 3
  • 19
  • 36
11
votes
1 answer

How should I be associating Core Data entities for use with RestKit?

I have two Core Data entities (Client and UserFile) that I have successfully set up a relationship between. I have created classes for both entities, and made them subclasses of RKManagedObject. When I create a new UserFile, I want to correctly…
nfm
  • 19,689
  • 15
  • 60
  • 90
11
votes
1 answer

Foreign key relationship mapping with RestKit

I'm totally new to RestKit and am struggling somewhat. JSON: { "teams": [ { "id": 1, "name": "Team A" }, { "id": 2, "name": "Team B" } ], "users": [ …
Camsoft
  • 11,718
  • 19
  • 83
  • 120
11
votes
3 answers

How not to map RestKit response?

I use RestKit to interact with a REST api. For some of the actions, like HTTP PUT/POST/DELETE, I only care about the response status code (200, or 500 etc), and don't care about the response data, even though the API does send back data. For…
yichen
  • 501
  • 1
  • 8
  • 15
11
votes
2 answers

RestKit and saving to CoreData as NSManagedObject

I'm using RestKit and i want to parse and save elements to core data. I have two json files: First (Category): [ { "cat_id": 3371, "cat_name": "myName", "image": 762 }, { "cat_id": 3367, "cat_name": "anotherName", …
Jakub
  • 13,712
  • 17
  • 82
  • 139
11
votes
2 answers

json response is interpreted as text/plain

I have the following code: NSURL *URL = [NSURL URLWithString:[@"some-address"]]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; RKObjectRequestOperation *requestOperation = [[RKObjectRequestOperation alloc]…
zyxel
  • 1,084
  • 3
  • 15
  • 23
11
votes
2 answers

Adding two request descriptors for a given class in Restkit 0.2

I need to make two different types of POST coming from the User class. //JSON Type A { "password":"12345", "email":"test@gmail.com" } //JSON Type B { "user":{ "Password":"12345", "Email":"sample@gmail.com" } } I've tried…
Frank Fu
  • 3,483
  • 2
  • 28
  • 38