Your SlideShare is downloading. ×
0
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
MTC: Hallo Welt – RESTful Services per RestKit ansprechen
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MTC: Hallo Welt – RESTful Services per RestKit ansprechen

915

Published on

Ein großer Teil der iOS Apps heutzutage kommuniziert auf die ein oder andere Weise mit der Aussenwelt. Eine weit verbreitete Möglichkeit dazu bieten RESTful Services. Doch wie bringe ich meiner App …

Ein großer Teil der iOS Apps heutzutage kommuniziert auf die ein oder andere Weise mit der Aussenwelt. Eine weit verbreitete Möglichkeit dazu bieten RESTful Services. Doch wie bringe ich meiner App bei REST zu sprechen? Die Lösung heisst RestKit. Diese Session vermittelt die Grundlagen zur Anbindung von REST Services sowie die damit verbundenen Techniken, wie das Mapping auf ein Objekt-Modell und Routing von REST Ressourcen auf bestehende Klassen. Zusätzlich wird auf die Unterstützung von Core Data eingegangen, um die geladenen Daten zu persistieren.

Published in: Mobile
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
915
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
14
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Hallo Welt - RESTful Services per Restkit Michael Kotten | open knowledge GmbH @michaelkotten @_openKnowledge
  • 2. Webservices sind überall MTC 2014 RESTful Services per RestKit
  • 3. Twitter JSON Beispiel MTC 2014 RESTful Services per RestKit { "id": 501673189681135616, "created_at": "Tue Aug 19 10:13:03 +0000 2014", "in_reply_to_screen_name": null, "in_reply_to_status_id": null, "in_reply_to_user_id": null, "retweet_count": 0, "retweeted": false, "text": "#Swift available for everybody now.", "user": { "id": 78700609, "name": "Michael Kotten", "screen_name": "michaelkotten", "created_at": "Wed Sep 30 20:28:36 +0000 2009", "followers_count": 13, "friends_count": 29, "statuses_count": 27 } }
  • 4. Twitter JSON Beispiel MTC 2014 RESTful Services per RestKit { "id": 501673189681135616, "created_at": "Tue Aug 19 10:13:03 +0000 2014", "in_reply_to_screen_name": null, "in_reply_to_status_id": null, "in_reply_to_user_id": null, "retweet_count": 0, "retweeted": false, "text": "#Swift available for everybody now.", "user": { "id": 78700609, "name": "Michael Kotten", "screen_name": "michaelkotten", "created_at": "Wed Sep 30 20:28:36 +0000 2009", "followers_count": 13, "friends_count": 29, "statuses_count": 27 } } Follow me
  • 5. Achtung, BETA! MTC 2014 RESTful Services per RestKit
  • 6. RESTful Services per NSUrlSession MTC 2014 RESTful Services per RestKit var sessionConfig = NSURLSessionConfiguration.defaultSessionConfiguration() sessionConfig.HTTPAdditionalHeaders = ["Accept" : "application/json"] ! var session = NSURLSession(configuration: sessionConfig) ! var task = session.dataTaskWithURL(url, completionHandler: { (data, response, error) in var json = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments, error: nil) as? Dictionary<String, AnyObject> var tweet = json[„text“] ... }) task.resume()
  • 7. RESTful Services richtig MTC 2014 RESTful Services per RestKit Aber wie denn jetzt?
  • 8. RestKit MTC 2014 RESTful Services per RestKit
  • 9. Was ist das? MTC 2014 RESTful Services per RestKit „RestKit is a RESTful Object Mapping Framework for iOS and OSX.“ – RestKit.org
  • 10. RestKit MTC 2014 RESTful Services per RestKit Warum ?
  • 11. RESTful Services per RestKit MTC 2014 Features A simple, high level Network layer Object Mapping Core Data support Easy switching environments Pluggable parsing layer
  • 12. RESTful Services per RestKit MTC 2014 Installation per CocoaPods ‣ CocoaPods installieren 1. gem install cocoapods 2. pod setup ‣ PodFile erzeugen platform :ios, '7.1' pod 'RestKit', '~> 0.23.2' ! $ pod install $ open MyProject.xcworkspace
  • 13. Objective-C importieren MTC 2014 RESTful Services per RestKit
  • 14. Objective-C importieren MTC 2014 RESTful Services per RestKit YES, please!
  • 15. MyRestKitApp-Bridging-Header.h MTC 2014 RESTful Services per RestKit // // Use this file to import your target's public headers that // you would like to expose to Swift. // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> #import <RestKit/RestKit.h> #import <RestKit/CoreData.h>
  • 16. Setup MTC 2014 RESTful Services per RestKit let baseUrl = NSURL(string: "https://twitter.com") ! // Initialize RestKit let objectManager = RKObjectManager(baseURL: baseUrl)
  • 17. Network Indicator MTC 2014 RESTful Services per RestKit AFNetworkActivityIndicatorManager.sharedManager().enabled = true
  • 18. Object Mapping MTC 2014 RESTful Services per RestKit Object Mapping
  • 19. Object Mapping MTC 2014 RESTful Services per RestKit „Object mapping is the process of taking a representation of data in one form and transforming it into another“ – RestKit.org
  • 20. RESTful Services per RestKit MTC 2014 Object Mapping - Features ‣ Mapping per Key-Value Coding ‣ automatische Transformation in Ziel-Typ ‣ erweiterbar ‣ Relationship-Mapping ‣ to-one und to-many ‣ Rekursiv
  • 21. RESTful Services per RestKit MTC 2014 Object Mapping ‣ RKObjectMapping ‣ Definiert die „Regeln“ für ein Mapping ‣ Property Mappings für Attribute und Beziehungen
  • 22. Object Mapping MTC 2014 RESTful Services per RestKit "user": { "id": 78700609, "name": "Michael Kotten", "screen_name": "michaelkotten" } class User : NSObject { var userId: NSNumber? var name: String? var screenName: String? }
  • 23. Object Mapping MTC 2014 RESTful Services per RestKit "user": { "id": 78700609, "name": "Michael Kotten", "screen_name": "michaelkotten" } class User : NSObject { var userId: NSNumber? var name: String? var screenName: String? }
  • 24. Object Mapping MTC 2014 RESTful Services per RestKit "user": { "id": 78700609, "name": "Michael Kotten", "screen_name": "michaelkotten" } class User : NSObject { var userId: NSNumber? var name: String? var screenName: String? } var userMapping = RKObjectMapping(forClass: User.self) userMapping.addAttributeMappingsFromDictionary([ "id" : "userId", "name" : "name", "screen_name" : "screenName"])
  • 25. Object Mapping MTC 2014 RESTful Services per RestKit "user": { "id": 78700609, "name": "Michael Kotten", "screen_name": "michaelkotten" } class User : NSObject { var userId: NSNumber? var name: String? var screenName: String? } var userMapping = RKObjectMapping(forClass: User.self) userMapping.addAttributeMappingsFromDictionary([ "id" : "userId", "name" : "name", "screen_name" : "screenName"])
  • 26. Swift und RestKit MTC 2014 RESTful Services per RestKit Mapping Klassen müssen von NSObject ableiten!
  • 27. Object Mapping MTC 2014 RESTful Services per RestKit class Tweet : NSObject { var tweetId: NSNumber? var createdAt: NSDate? var text: String? var inReplyToScreenName: String? var user: User? } { "id": 501673189681135616, "created_at": "Tue Aug 19 10:13:03 +0000 2014", "in_reply_to_screen_name": null, "text": "#Swift available for everybody now.“, "user": { "id": 78700609, "name": "Michael Kotten", "screen_name": "michaelkotten" } }
  • 28. Object Mapping MTC 2014 RESTful Services per RestKit class Tweet : NSObject { var tweetId: NSNumber? var createdAt: NSDate? var text: String? var inReplyToScreenName: String? var user: User? } { "id": 501673189681135616, "created_at": "Tue Aug 19 10:13:03 +0000 2014", "in_reply_to_screen_name": null, "text": "#Swift available for everybody now.“, "user": { "id": 78700609, "name": "Michael Kotten", "screen_name": "michaelkotten" } } ?
  • 29. Object Mapping MTC 2014 RESTful Services per RestKit let tweetMapping = RKObjectMapping(forClass: Tweet.self) tweetMapping.addAttributeMappingsFromDictionary([ "id" : "tweetId", "created_at" : "createdAt", "text" : "text", "in_reply_to_screen_name" : "inReplyToScreenName"]) ! let relationshipMapping = RKRelationshipMapping(fromKeyPath: "user", toKeyPath: "user", withMapping: userMapping) ! tweetMapping.addPropertyMapping(relationshipMapping)
  • 30. RESTful Services per RestKit MTC 2014 Response Descriptor ‣ RKResponseDescriptor ‣ Object Mapping ‣ URL Pattern ‣ Key Path ‣ HTTP Status Codes
  • 31. Response Descriptor MTC 2014 RESTful Services per RestKit let responseDescriptor = RKResponseDescriptor( mapping: tweetMapping, method: RKRequestMethod.GET, pathPattern: "/status/user_timeline/:username", keyPath: nil, statusCodes: RKStatusCodeIndexSetForClass( UInt(RKStatusCodeClassSuccessful))) ! objectManager.addResponseDescriptor(responseDescriptor)
  • 32. GETting Objects MTC 2014 RESTful Services per RestKit objectManager.getObjectsAtPath( "/status/user_timeline/michaelkotten", parameters: nil, success: { (operation: RKObjectRequestOperation!, mappingResult: RKMappingResult!) -> () in self.tweets = mappingResult.array() as [Tweet] println("(self.tweets.count) tweets loaded") self.tableView.reloadData() }, failure: { (operation: RKObjectRequestOperation!, error: NSError!) -> () in println("Error loading tweets: (error)") })
  • 33. RESTful Services per RestKit MTC 2014 GETting Objects ‣ GET Request per RKObjectRequestOperation ‣ Response verarbeiten per RKResponseMapperOperation ‣ Content-Type bestimmen ‣ application/json -> NSJSONSerialization ‣ RKResponseDescriptor finden ‣ URL Pattern ‣ Key Path ‣ Status Codes
  • 34. RESTful Services per RestKit MTC 2014 GETting Objects ‣ Mapping ausführen per RKMappingOperation ‣ valueForKeyPath("text") ‣ Transformation für NSDate etc. ‣ setValue("#Swift available for every…", forKeyPath: "text") ! ‣ Ergebnis als RKMappingResult ‣ Enthält Mapping Objekte
  • 35. GETting Objects MTC 2014 RESTful Services per RestKit
  • 36. „That‘s the way, we like it!“
  • 37. Persistierung MTC 2014 RESTful Services per RestKit ‣ POST, PATCH/PUT und DELETE ‣ Inverse Mapping ‣ RKRequestDescriptor
  • 38. Persistierung MTC 2014 RESTful Services per RestKit var inverseMapping = tweetMapping.inverseMapping() var requestDescriptor = RKRequestDescriptor( mapping: inverseMapping, objectClass: Tweet.self, rootKeyPath: "status", method: RKRequestMethod.POST) objectManager.addRequestDescriptor(requestDescriptor)
  • 39. POSTing Objects MTC 2014 RESTful Services per RestKit var tweet = Tweet() tweet.text = "This tweet was posted using #RestKit!" objectManager.postObject( tweet, path: "statuses/update.json", parameters: nil, success: { (operation: RKObjectRequestOperation!, mappingResult: RKMappingResult!) in println("tweet successfully posted") }, failure: { (operation: RKObjectRequestOperation!, error: NSError!) in println("tweet post failed!") })
  • 40. RESTful Services per RestKit MTC 2014 POSTing Objects ‣ POST Request per RKObjectRequestOperation ‣ erzeugt NSURLRequest für URL ‣ passenden RKRequestDescriptor finden ‣ inverse Mapping ‣ Transformation nach NSDictionary ! ‣ Ergebnis wieder als RKMappingResult
  • 41. RESTful Services per RestKit MTC 2014 PUT, PATCH und DELETE ‣ Übrige CRUD Operation analog: ‣ objectManager.putObject(…) ‣ objectManager.patchObject(…) ‣ objectManager.deleteObject(…)
  • 42. RESTful Services per RestKit MTC 2014 Routing ‣ Zentrale Erzeugung von Urls ‣ minimiert Verwendung von Path Patterns ‣ Drei Typen von RKRoute ‣ Named Routes ‣ Class Routes ‣ Relationship Routes
  • 43. Named Routes MTC 2014 RESTful Services per RestKit objectManager.router.routeSet.addRoute( RKRoute(name: "myTimeline", pathPattern: "/status/user_timeline/michaelkotten", method: RKRequestMethod.GET) )
  • 44. Named Routes MTC 2014 RESTful Services per RestKit objectManager.router.routeSet.addRoute( RKRoute(name: "myTimeline", pathPattern: "/status/user_timeline/michaelkotten", method: RKRequestMethod.GET) ) objectManager.getObjectsAtPathForRouteNamed("myTimeline", object: nil, parameters: nil, success: { (operation: RKObjectRequestOperation!, mappingResult: RKMappingResult!) -> () in self.tweets = mappingResult.array() as [Tweet] println("(self.tweets.count) tweets loaded") self.tableView.reloadData() }, failure: { (operation: RKObjectRequestOperation!, error: NSError!) -> () in println("Error loading tweets: (error)") })
  • 45. Class Routes MTC 2014 RESTful Services per RestKit objectManager.router.routeSet.addRoute( RKRoute(class: Tweet.self, pathPattern: "/statuses/update.json", method: RKRequestMethod.POST))
  • 46. Class Routes MTC 2014 RESTful Services per RestKit objectManager.router.routeSet.addRoute( RKRoute(class: Tweet.self, pathPattern: "/statuses/update.json", method: RKRequestMethod.POST)) let tweet = Tweet() tweet.text = "This tweet was posted using #RestKit!" objectManager.postObject(user, path: nil, parameters: nil, success: { (operation: RKObjectRequestOperation!, mappingResult: RKMappingResult!) -> () in println("tweet successfully posted") }, failure: { (operation: RKObjectRequestOperation!, error: NSError!) -> () in println("tweet post failed!") })
  • 47. Class Routes MTC 2014 RESTful Services per RestKit objectManager.router.routeSet.addRoute( RKRoute(class: Tweet.self, pathPattern: "/statuses/update.json", method: RKRequestMethod.POST)) let tweet = Tweet() tweet.text = "This tweet was posted using #RestKit!" objectManager.postObject(user, path: nil, parameters: nil, success: { (operation: RKObjectRequestOperation!, mappingResult: RKMappingResult!) -> () in println("tweet successfully posted") }, failure: { (operation: RKObjectRequestOperation!, error: NSError!) -> () in println("tweet post failed!") })
  • 48. Class Routes MTC 2014 RESTful Services per RestKit objectManager.router.routeSet.addRoute( RKRoute(`class`: Tweet.self, pathPattern: "/statuses/update.json", method: RKRequestMethod.POST)) let tweet = Tweet() tweet.text = "This tweet was posted using #RestKit!" objectManager.postObject(user, path: nil, parameters: nil, success: { (operation: RKObjectRequestOperation!, mappingResult: RKMappingResult!) -> () in println("tweet successfully posted") }, failure: { (operation: RKObjectRequestOperation!, error: NSError!) -> () in println("tweet post failed!") })
  • 49. Relationship Routes MTC 2014 RESTful Services per RestKit var responseDescriptor = RKResponseDescriptor( mapping: userMapping, method: RKRequestMethod.GET, pathPattern: "/status/:tweetId/retweeted_by", keyPath: nil, statusCodes: NSIndexSet(index: 200)) objectManager.addResponseDescriptor(responseDescriptor) ! objectManager.router.routeSet.addRoute( RKRoute(relationshipName: „retweeted_by", objectClass: Tweet.self, pathPattern: "/status/:tweetId/retweeted_by", method: RKRequestMethod.GET))
  • 50. Relationship Routes MTC 2014 RESTful Services per RestKit var responseDescriptor = RKResponseDescriptor( mapping: userMapping, method: RKRequestMethod.GET, pathPattern: "/status/:tweetId/retweeted_by", keyPath: nil, statusCodes: NSIndexSet(index: 200)) objectManager.addResponseDescriptor(responseDescriptor) ! objectManager.router.routeSet.addRoute( RKRoute(relationshipName: „retweeted_by", objectClass: Tweet.self, pathPattern: "/status/:tweetId/retweeted_by", method: RKRequestMethod.GET)) var tweet = Tweet() tweet.tweetId = 4711 objectManager.getObjectsAtPathForRelationship("retweeted_by", ofObject: tweet, parameters: nil, success: { (operation: RKObjectRequestOperation!, mappingResult: RKMappingResult!) -> () in var users = mappingResult.array() as [User] println("(users.count) retweets loaded") }, failure: { (operation: RKObjectRequestOperation!, error: NSError!) -> () in println("Error loading retweets: (error)") })
  • 51. Core Data MTC 2014 RESTful Services per RestKit
  • 52. Core Data MTC 2014 RESTful Services per RestKit Managed Object Store
  • 53. Managed Object Store MTC 2014 RESTful Services per RestKit var objectManager = RKObjectManager(baseURL: baseUrl) ! let managedObjectStore = RKManagedObjectStore( persistentStoreCoordinator: persistentStoreCoordinator) objectManager.managedObjectStore = managedObjectStore
  • 54. Core Data MTC 2014 RESTful Services per RestKit Mapping ändern
  • 55. Mapping ändern MTC 2014 RESTful Services per RestKit class User : NSObject { var userId: NSNumber? var name: String? var screenName: String? }
  • 56. Mapping ändern MTC 2014 RESTful Services per RestKit @objc(User) class User : NSManagedObject { @NSManaged var userId: NSNumber? @NSManaged var name: String? @NSManaged var screenName: String?
  • 57. Mapping ändern MTC 2014 RESTful Services per RestKit @objc(User) class User : NSManagedObject { @NSManaged var userId: NSNumber? @NSManaged var name: String? @NSManaged var screenName: String? }
  • 58. Mapping ändern MTC 2014 RESTful Services per RestKit @objc(User) class User : NSManagedObject { @NSManaged var userId: NSNumber? @NSManaged var name: String? @NSManaged var screenName: String? }
  • 59. Mapping ändern MTC 2014 RESTful Services per RestKit @objc(User) class User : NSManagedObject { @NSManaged var userId: NSNumber? @NSManaged var name: String? @NSManaged var screenName: String? }
  • 60. Mapping ändern MTC 2014 RESTful Services per RestKit var userMapping = RKObjectMapping(forClass: User.self) userMapping.addAttributeMappingsFromDictionary([ "id" : "userId", "name" : "name", "screen_name" : "screenName"])
  • 61. Mapping ändern MTC 2014 RESTful Services per RestKit var userMapping = RKObjectMapping(forClass: User.self) userMapping.addAttributeMappingsFromDictionary([ "id" : "userId", "name" : "name", "screen_name" : "screenName"]) var userMapping = RKEntityMapping(forEntityForName: "User", inManagedObjectStore: managedObjectStore) userMapping.identificationAttributes = ["userId"] userMapping.addAttributeMappingsFromDictionary([ "id" : "userId", "name" : "name", "screen_name" : "screenName"])
  • 62. Core Data MTC 2014 RESTful Services per RestKit Core Data Model
  • 63. Core Data Model MTC 2014 RESTful Services per RestKit
  • 64. Core Data MTC 2014 RESTful Services per RestKit Managed Object Context
  • 65. Managed Object Context MTC 2014 RESTful Services per RestKit managedObjectStore.createManagedObjectContexts()
  • 66. Core Data MTC 2014 RESTful Services per RestKit Objekte erzeugen
  • 67. Objekte erzeugen MTC 2014 RESTful Services per RestKit let managedObjectContext = objectManager.managedObjectStore.mainQueueManagedObjectContext ! var description = NSEntityDescription.entityForName(„Tweet", inManagedObjectContext:managedObjectContext) ! var tweet = Tweet(entity: description, insertIntoManagedObjectContext: managedObjectContext)
  • 68. MTC 2014 RESTful Services per RestKit Fazit Abspann
  • 69. Lohnt sich das denn?
  • 70. RESTful Services per RestKit MTC 2014 Fazit ‣ Bietet viele Features ‣ Relativ einfache API ‣ Aktive Entwicklung & Community ‣ Für einfache Webservices oversized ‣ Abhängigkeit muss abgewogen werden
  • 71. Get it now! MTC 2014 RESTful Services per RestKit https://github.com/ RestKit/RestKit
  • 72. Hallo Welt - RESTful Services per Restkit Michael Kotten | open knowledge GmbH @michaelkotten @_openKnowledge

×