• Like
mobile in the cloud with diamonds. improved.
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

mobile in the cloud with diamonds. improved.

  • 743 views
Published

Software development evolution is here. We gotta open source. We making better blocks. …

Software development evolution is here. We gotta open source. We making better blocks.
In this presentation I show you some iOS related techniques for automatic data synchronisation. And overall - tools for rapid development and testing your software.

Published in Technology , Design
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
743
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
4
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. MOBILE IN THE CLOUD WITH DIAMONDS 2013 2013
  • 2. Mobile & Cloud Content Bicycles we ride Essential frameworks Advanced frameworks Wondertools You don't test me Backends Imagination
  • 3. mobile and the internets m
  • 4. Developer’s dilemma ★ ★ ★ faster know how solves the problem VS FRAMEWORKS ★ ★ ★ tested independent supported
  • 5. FRAMEWORKS That could be a pain RESTawful services
  • 6. Data and Cloud Core Data
  • 7. Data and Cloud NSOperation Core Data
  • 8. Data and Cloud NSURLConnection NSOperation Core Data
  • 9. Data and Cloud AFNetworking NSURL *url = [NSURL URLWithString:@"https://alpha-api.app.net/ stream/0/posts/stream/global"];! NSURLRequest *request = [NSURLRequest requestWithURL:url];! AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {! NSLog(@"App.net Global Stream: %@", JSON);! } failure:nil];! [operation start]; NSURLConnection NSOperation Core Data
  • 10. Data and Cloud REST KIT AFNetworking NSURLConnection NSOperation Core Data
  • 11. Data and Cloud REST AFNetworking NSURLConnection KIT NSOperation Core Data
  • 12. Data and Cloud - RestKit Data Mapping REST AFNetworking NSURLConnection KIT NSOperation Core Data
  • 13. RestKit example @interface RKTweet NSObject! @interface RKTweet : : NSObject! @property (nonatomic, copy) NSNumber *userID;! @property (nonatomic, copy) NSNumber *userID;! @property (nonatomic, copy) NSString *username;! @property (nonatomic, copy) NSString *text;! @property (nonatomic, copy) NSString *username;! @property (nonatomic, copy) NSString *text;! @end! @end! ! RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[RKTweet class]];! [mapping addAttributeMappingsFromDictionary:@{! @"user.name": @"username",! @"user.id": @"userID",! @"text": @"text"! }];! RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping pathPattern:nil keyPath:nil statusCodes:nil];! NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1/statuses/ public_timeline.json"];! NSURLRequest *request = [NSURLRequest requestWithURL:url];! RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]];! [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) {! NSLog(@"The public timeline Tweets: %@", [result array]);! } failure:nil];! [operation start];
  • 14. RestKit example @interface RKTweet : NSObject! @property (nonatomic, copy) NSNumber *userID;! @property (nonatomic, copy) NSString *username;! @property (nonatomic, copy) NSString *text;! @end! ! RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[RKTweet class]];! RKObjectMapping *mapping = [RKObjectMapping mappingForClass: [mapping class]];! [RKTweet addAttributeMappingsFromDictionary:@{! @"user.name": @"username",! [mapping addAttributeMappingsFromDictionary:@{! @"user.id": @"userID",! @"user.name": @"text"! @"username",! @"text": @"userID",! }];! @"user.id": ! @"text": @"text"! RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor }]; responseDescriptorWithMapping:mapping pathPattern:nil keyPath:nil statusCodes:nil];! ! NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1/statuses/ public_timeline.json"];! NSURLRequest *request = [NSURLRequest requestWithURL:url];! RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]];! ! [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) {! NSLog(@"The public timeline Tweets: %@", [result array]);! } failure:nil];! [operation start];
  • 15. RestKit example @interface RKTweet : NSObject! @property (nonatomic, copy) NSNumber *userID;! @property (nonatomic, copy) NSString *username;! @property (nonatomic, copy) NSString *text;! @end! RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[RKTweet class]];! [mapping addAttributeMappingsFromDictionary:@{! @"user.name": @"username",! @"user.id": @"userID",! @"text": @"text"! }];! RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping pathPattern:nil keyPath:nil responseDescriptorWithMapping:mapping pathPattern:nil keyPath:nil statusCodes:nil];! statusCodes:nil];! URLWithString:@"http://api.twitter.com/1/statuses/ NSURL *url = [NSURL public_timeline.json"];! NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1/ NSURLRequest *request = [NSURLRequest statuses/public_timeline.json"];! requestWithURL:url];! RKObjectRequestOperation [NSURLRequest requestWithURL:url];! NSURLRequest *request = *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]];! RKObjectRequestOperation *operation = [[RKObjectRequestOperation [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation alloc] initWithRequest:request *operation, RKMappingResult *result) {! responseDescriptors:@[responseDescriptor]]; NSLog(@"The public timeline Tweets: %@", [result array]);! } failure:nil];! [operation start];
  • 16. RestKit example @interface RKTweet : NSObject! @property (nonatomic, copy) NSNumber *userID;! @property (nonatomic, copy) NSString *username;! @property (nonatomic, copy) NSString *text;! @end! RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[RKTweet class]];! [mapping addAttributeMappingsFromDictionary:@{! @"user.name": @"username",! @"user.id": @"userID",! @"text": @"text"! }];! RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping pathPattern:nil keyPath:nil statusCodes:nil];! NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1/statuses/ public_timeline.json"];! NSURLRequest *request = [NSURLRequest requestWithURL:url];! RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]];! [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) {! *operation, RKMappingResult *result) {! NSLog(@"The public timeline Tweets: %@", [result array]);! NSLog(@"The public timeline Tweets: %@", [result array]);! } failure:nil];! } failure:nil];! [operation start]; [operation start];
  • 17. RestKit example @interface RKTweet : NSObject! @property (nonatomic, copy) NSNumber *userID;! @property (nonatomic, copy) NSString *username;! @property (nonatomic, copy) NSString *text;! @end! RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[RKTweet class]];! [mapping addAttributeMappingsFromDictionary:@{! @"user.name": @"username",! @"user.id": @"userID",! @"text": @"text"! }];! RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping pathPattern:nil keyPath:nil statusCodes:nil];! NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1/statuses/ public_timeline.json"];! NSURLRequest *request = [NSURLRequest requestWithURL:url];! RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]];! [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) {! NSLog(@"The public timeline Tweets: %@", [result array]);! } failure:nil];! [operation start];
  • 18. Next Step NSIncrementalStore NSURLConnection NSOperation Core Data
  • 19. Next Step AFNetworking NSIncrementalStore NSURLConnection NSOperation Core Data
  • 20. Next Step AFNetworking NSURLConnection NSIncrementalStore NSOperation Core Data
  • 21. Next Step - Data Sync AFIncrementalStore AFNetworking NSURLConnection NSIncrementalStore NSOperation Core Data
  • 22. a snap into AFIncrementalStore usual unusual YOUR CODE YOUR CODE RESTful server CoreData framework CoreData framework + AF Incremental Store AFNetworking
  • 23. working with AFIncrementalStore is the same as with CoreData @interface TasksViewController()<NSFetchedResultsControllerDelegate>! @property NSFetchedResultsController *fetchedResultsController;! @end! ! - (UITableViewCell *)tableView:(UITableView *)tableView! cellForRowAtIndexPath:(NSIndexPath *)indexPath ! {! ...! [self configureCell:cell forRowAtIndexPath:indexPath];! return cell;! }! ! - (void)configureCell:(UITableViewCell *)cell ! forRowAtIndexPath:(NSIndexPath *)indexPath ! {! NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath];! cell.textLabel.text = [managedObject valueForKey:@"text"];!
  • 24. ? ? ? Business Logic AFIncrementalStore
  • 25. ⦿Push Notifications ⦿InAppPurchase ⦿ Analytics ⦿ Passbook ⦿ Newsstand Sync. with just one command...* #  helios  server
  • 26. Helios-ready iOS frameworks Antenna Cargo Bay Extensible Remote Logging The Essential StoreKit Companion Orbiter AFIncrementalStore Push Notification Registration Core Data Persistence with AFNetworking, Done Right SkyLab Multivariate & A/B Testing Ground Control Remote Configuration AFNetworking A Delightful iOS & OS X Networking Framework
  • 27. Cocoa Pods http://cocoapods.org $ [sudo] gem install cocoapods $ pod setup myproject$ pod install Podfile example: platform :ios, '7.0' pod 'AFNetworking', '~> 2.0.3’ pod 'ICViewPager', '~> 1.5’ RestKit AFNetworking AFIncrementalStore AFAmazonS3Client ... https://github.com/ CocoaPods/Specs
  • 28. Testing ★ many frameworks comes with tests, bros KIF FRANK https://github.com/kif-framework/KIF https://github.com/moredip/Frank
  • 29. KIF ★ ★ ★ leveraging the accessibility attributes conducted synchronously in the main thread uses undocumented Apple APIs - (void)testSuccessfulLogin! {! [tester enterText:@"user@example.com" intoViewWithAccessibilityLabel:@"Login User Name"];! [tester enterText:@"thisismypassword" intoViewWithAccessibilityLabel:@"Login Password"];! [tester tapViewWithAccessibilityLabel:@"Log In"];! ! // Verify that the login succeeded! [tester waitForTappableViewWithAccessibilityLabel:@"Welcome"];! }
  • 30. ★ ★ ★ ★ FRANK from outer ruby space ‘cucumber’ 'Selenium for native iOS apps'. uses undocumented Apple APIs totally different approach to testing in iOS Feature: Various scenarios that exercise different parts of Frank! ! Background:! Given I launch the app ! ! Scenario: Counting number of rows in a table section! Then I should see 3 rows in section 0! ! Scenario: Scrolling to the bottom of the table ! When I touch "Larry Stooge"! And I touch "User Roles"! Then I should not see "Returns"! When I scroll to the bottom of the table! Then I should see "Returns"
  • 31. READY TO USE CLOUDS ★Deployd.com - free to use - javascript based ★★Parse.com -all essential platforms supported -“out of the box” basic data entities -free to test ★★★APIgee.com (books & webcasts) - developer console to popular services - intermediate data processing (eg. - convert xml to json, mapping, etc) free to test
  • 32. Oleg.Shanyuk@gmail.com @gelosi - http://obrij.com AFNetworking, AFIncrementalStore, AF*** https://github.com/helios-framework/helios RESTKit - https://github.com/RestKit/RestKit CocoaPods - http://cocoapods.org Follow: @mattt, @soffes, @gruber, @edog1203