SlideShare a Scribd company logo
Web                          iOS 5
      (id:ninjinkun / @ninjinkun)
Cocoa

 •   10

 •   Next Step, Mac OSX

 •
 •                 ><

     •
iOS

 •    iOS

 •
 •    SDK

 •

 •    Apple

 •    Web
•   iOS


•   iOS 4, iOS 5
•   Objective-C   JavaScript   !

    •     iOS 5
•    (Blocks)
                JavaScript
•   (GCD)

•    (ARC)
(Blocks)
            JavaScript

•   JavaScript

    •       Ajax API

        function sendRequest (url) {
            var req = new XMLHttpRequest();
            //
             req.onreadystatechange = function(){
                 if (req.readyState == 4) {
                     if (req.status == 200) {
                        console.log("success");
                     }
                 }

             };
             req.open("GET", url);
             req.send();
        }
(Blocks)
       Objective-C

•   iOS 4           Objective-C

@interface Downloader : NSObject {
    NSURLConnection *conn;
}
@end

@implementation Downloader

- (void)sentRequest:(NSURL *)url {
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    //
     conn = [NSURLConnection connectionWithRequest:req delegate:self];
}

- (void)connection:( NSURLConnection *) connection didReceiveResponse:
( NSURLResponse *) response {
    // delegate
     NSLog(@"success");
}

@end
(Blocks)
       Objective-C

•   iOS 4           Objective-C

@interface Downloader : NSObject {
    NSURLConnection *conn;
}
@end

@implementation Downloader

- (void)sentRequest:(NSURL *)url {
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    //
     conn = [NSURLConnection connectionWithRequest:req delegate:self];
}

- (void)connection:( NSURLConnection *) connection didReceiveResponse:
( NSURLResponse *) response {
    // delegate
     NSLog(@"success");
}

@end
(Blocks)
iOS 4

 •                     (Blocks)

     •
     •    SDK                                 Blocks

 •
         void(^hogeHandler)(NSArray *) = ^(NSArray *array){
             NSLog(@"hoge");
         };
(Blocks)

@interface Downloader : NSObject {
    NSOperationQueue *queue;
}
@end

@implementation Downloader

- (void)sendRequest {
    queue = [[NSOperationQueue alloc] init];
    NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL
URLWithString:@"http://www.apple.com/"]];
    //
    [NSURLConnection sendAsynchronousRequest:req queue:queue
completionHandler:^(NSURLResponse *res, NSData *data, NSError *err) {
        if ([(NSHTTPURLResponse *)res statusCode] == 200) {
            //
                 NSLog(@"success");
             }
       }];
}

@end
(Blocks)

@interface Downloader : NSObject {
    NSOperationQueue *queue;
}
@end

@implementation Downloader

- (void)sendRequest {
    queue = [[NSOperationQueue alloc] init];
    NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL
URLWithString:@"http://www.apple.com/"]];
    //
    [NSURLConnection sendAsynchronousRequest:req queue:queue
completionHandler:^(NSURLResponse *res, NSData *data, NSError *err) {
        if ([(NSHTTPURLResponse *)res statusCode] == 200) {
            //
                 NSLog(@"success");
             }
       }];
}

@end                                                                    !
(GCD)
JavaScript

 •   JavaScript

     •
     •
         •
 •   iOS

     •
         •
     •
(GCD)
iOS 4

 •
  @interface FileReader : NSObject {
      NSString *fileContent;
  }
  @property (nonatomic, assign) id delegate;
  @end

  @implementation FileReader

  -(void)readFile:(NSString *)filename {
      [self performSelectorInBackground:@selector(readFileOnBackground:)
  withObject:filename];
  }

  //
  -(void)readFileOnBackground:(NSString *)filename {
      NSError *err = nil;
      fileContent = [NSString stringWithContentsOfFile:filename
  encoding:NSUTF8StringEncoding error:&err];
      // UI
      [delegate performSelectorOnMainThread:@selector(updateViewWithFile:)
  withObject:fileContent waitUntilDone:NO];
  }

  @end
(GCD)
iOS 4

 •   Grand Central Dispatch

 •
 •
 •
 •
     •
(GCD)
iOS 4

 •
@interface FileReader : NSObject
@property (nonatomic, assign) id delegate;
@end

@implementation FileReader

-(void)readFile:(NSString *)filename {
    //
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),
^{
        NSError *err = nil;
        NSString *fileContent = [NSString stringWithContentsOfFile:filename
encoding:NSUTF8StringEncoding error:&err];
        //
             dispatch_async(dispatch_get_main_queue(), ^{
                 [delegate updateViewWithFile:fileContent];
             });
       });
}
@end
(ARC)
JavaScript

 •   GC

     •

 •   Web
(ARC)
iOS 5

    •
@interface User : NSObject {
    NSString *name;
    NSString *imageUrl;
}
@end

@implementation User
-(id)initWithDictionary:(NSDictionary *)dict {
    self = [super init];
    if (self) {
        name = [[dict objectForKey:@"name"] retain]; //
            imageUrl = [[dict objectForKey:@"image_url"] retain];
        }
        return self;
}

//
-(void)dealloc {
     [name release];
     [imageUrl release];
     [super dealloc];
}
@end
(ARC)
iOS 5

    •
@interface User : NSObject {
    NSString *name;
    NSString *imageUrl;
}
@end

@implementation User
-(id)initWithDictionary:(NSDictionary *)dict {
    self = [super init];
    if (self) {
        name = [[dict objectForKey:@"name"] retain]; //
            imageUrl = [[dict objectForKey:@"image_url"] retain];
        }
        return self;
}

//
-(void)dealloc {
     [name release];
     [imageUrl release];
     [super dealloc];
}
@end
(ARC)
iOS 5

 •   Automatic Reference Counting
 •
 •
     •
     •
(ARC)
iOS 5

 •                                !

  @interface User : NSObject {
      NSString *name;
      NSString *imageUrl;
  }
  @end

  @implementation User
  -(id)initWithDictionary:(NSDictionary *)dict {
      self = [super init];
      if (self) {
          name = [dict objectForKey:@"name"];
          imageUrl = [dict objectForKey:@"image_url"];
      }
      return self;
  }
  //
  @end
GC

•   GC

    •   iOS

    •
•
    •   CPU
•   Objective-C   JavaScript       !

    •   …                      …

•   Objective-C

    •
•   iOS

    •

More Related Content

PDF
OneRing @ OSCamp 2010
PDF
Everybody Loves AFNetworking ... and So Can you!
PDF
Javascript call ObjC
PDF
Annotation processing and code gen
PDF
Working with AFNetworking
KEY
New Design of OneRing
ODP
Using Logstash, elasticsearch & kibana
PDF
React for Beginners
OneRing @ OSCamp 2010
Everybody Loves AFNetworking ... and So Can you!
Javascript call ObjC
Annotation processing and code gen
Working with AFNetworking
New Design of OneRing
Using Logstash, elasticsearch & kibana
React for Beginners

What's hot (20)

PDF
Fast C++ Web Servers
PDF
Logstash-Elasticsearch-Kibana
PPTX
Java Play RESTful ebean
PPTX
MongoDB: tips, trick and hacks
PPTX
Java Play Restful JPA
PDF
Introduction to reactive programming & ReactiveCocoa
KEY
Node.js - Best practices
PDF
Solr Indexing and Analysis Tricks
PDF
PPTX
Dockercompose
PDF
Akka Cluster in Java - JCConf 2015
PPTX
Elk stack
PDF
Scripting GeoServer
PDF
openstack源码分析(1)
PDF
Debugging and Testing ES Systems
PDF
MySQL in Go - Golang NE July 2015
PPTX
How to create a libcloud driver from scratch
PPTX
How to create a libcloud driver from scratch
PDF
Exploring Clojurescript
PDF
Go database/sql
Fast C++ Web Servers
Logstash-Elasticsearch-Kibana
Java Play RESTful ebean
MongoDB: tips, trick and hacks
Java Play Restful JPA
Introduction to reactive programming & ReactiveCocoa
Node.js - Best practices
Solr Indexing and Analysis Tricks
Dockercompose
Akka Cluster in Java - JCConf 2015
Elk stack
Scripting GeoServer
openstack源码分析(1)
Debugging and Testing ES Systems
MySQL in Go - Golang NE July 2015
How to create a libcloud driver from scratch
How to create a libcloud driver from scratch
Exploring Clojurescript
Go database/sql
Ad

Viewers also liked (9)

PDF
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
ZIP
集合知プログラミング第2章復習
PDF
インターン講義8日目「データ構造」
PDF
財政学A(2008)
PDF
国と地方関係論(2008)
ZIP
Algorithm Introduction #18 B-Tree
PDF
趣味プロダクトで楽しいコードライフワークを送る
PDF
機械学習で泣かないためのコード設計
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
集合知プログラミング第2章復習
インターン講義8日目「データ構造」
財政学A(2008)
国と地方関係論(2008)
Algorithm Introduction #18 B-Tree
趣味プロダクトで楽しいコードライフワークを送る
機械学習で泣かないためのコード設計
Ad

Similar to Webエンジニアから見たiOS5 (20)

PDF
Developing iOS REST Applications
KEY
UIWebView Tips
PDF
Beginning icloud development - Cesare Rocchi - WhyMCA
PDF
iOS 2 - The practical Stuff
PDF
ARCでめちゃモテiOSプログラマー
PDF
iOS for ERREST
PDF
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
PPTX
Full stack development with node and NoSQL - All Things Open - October 2017
PPTX
Full Stack Development with Node.js and NoSQL
KEY
iOS5 NewStuff
PDF
Parse London Meetup - Cloud Code Tips & Tricks
PDF
iOS App with Parse.com as RESTful Backend
PDF
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
PDF
mobile in the cloud with diamonds. improved.
PDF
MFF UK - Introduction to iOS
PPTX
What's Parse
PDF
FI MUNI 2012 - iOS Basics
PDF
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
KEY
CouchDB on Android
KEY
RESTfull with RestKit
Developing iOS REST Applications
UIWebView Tips
Beginning icloud development - Cesare Rocchi - WhyMCA
iOS 2 - The practical Stuff
ARCでめちゃモテiOSプログラマー
iOS for ERREST
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Full stack development with node and NoSQL - All Things Open - October 2017
Full Stack Development with Node.js and NoSQL
iOS5 NewStuff
Parse London Meetup - Cloud Code Tips & Tricks
iOS App with Parse.com as RESTful Backend
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
mobile in the cloud with diamonds. improved.
MFF UK - Introduction to iOS
What's Parse
FI MUNI 2012 - iOS Basics
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
CouchDB on Android
RESTfull with RestKit

More from Satoshi Asano (7)

PDF
I phoneアプリの通信エラー処理
ZIP
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
PDF
Google Analytics & iPhone
PDF
iPhoneアプリ開発講座Web連携アプリ編
PDF
Asihttp requestについて
PDF
バックグラウンド位置取得について
ZIP
iPhoneアプリ開発講座入門編
I phoneアプリの通信エラー処理
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
Google Analytics & iPhone
iPhoneアプリ開発講座Web連携アプリ編
Asihttp requestについて
バックグラウンド位置取得について
iPhoneアプリ開発講座入門編

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Electronic commerce courselecture one. Pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PDF
Machine learning based COVID-19 study performance prediction
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
20250228 LYD VKU AI Blended-Learning.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
Encapsulation_ Review paper, used for researhc scholars
Electronic commerce courselecture one. Pdf
Empathic Computing: Creating Shared Understanding
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Monthly Chronicles - July 2025
Building Integrated photovoltaic BIPV_UPV.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
Machine learning based COVID-19 study performance prediction
“AI and Expert System Decision Support & Business Intelligence Systems”
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Understanding_Digital_Forensics_Presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation

Webエンジニアから見たiOS5

  • 1. Web iOS 5 (id:ninjinkun / @ninjinkun)
  • 2. Cocoa • 10 • Next Step, Mac OSX • • >< •
  • 3. iOS • iOS • • SDK • • Apple • Web
  • 4. iOS • iOS 4, iOS 5
  • 5. Objective-C JavaScript ! • iOS 5
  • 6. (Blocks) JavaScript • (GCD) • (ARC)
  • 7. (Blocks) JavaScript • JavaScript • Ajax API function sendRequest (url) { var req = new XMLHttpRequest(); // req.onreadystatechange = function(){ if (req.readyState == 4) { if (req.status == 200) { console.log("success"); } } }; req.open("GET", url); req.send(); }
  • 8. (Blocks) Objective-C • iOS 4 Objective-C @interface Downloader : NSObject { NSURLConnection *conn; } @end @implementation Downloader - (void)sentRequest:(NSURL *)url { NSURLRequest *req = [NSURLRequest requestWithURL:url]; // conn = [NSURLConnection connectionWithRequest:req delegate:self]; } - (void)connection:( NSURLConnection *) connection didReceiveResponse: ( NSURLResponse *) response { // delegate NSLog(@"success"); } @end
  • 9. (Blocks) Objective-C • iOS 4 Objective-C @interface Downloader : NSObject { NSURLConnection *conn; } @end @implementation Downloader - (void)sentRequest:(NSURL *)url { NSURLRequest *req = [NSURLRequest requestWithURL:url]; // conn = [NSURLConnection connectionWithRequest:req delegate:self]; } - (void)connection:( NSURLConnection *) connection didReceiveResponse: ( NSURLResponse *) response { // delegate NSLog(@"success"); } @end
  • 10. (Blocks) iOS 4 • (Blocks) • • SDK Blocks • void(^hogeHandler)(NSArray *) = ^(NSArray *array){ NSLog(@"hoge"); };
  • 11. (Blocks) @interface Downloader : NSObject { NSOperationQueue *queue; } @end @implementation Downloader - (void)sendRequest { queue = [[NSOperationQueue alloc] init]; NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com/"]]; // [NSURLConnection sendAsynchronousRequest:req queue:queue completionHandler:^(NSURLResponse *res, NSData *data, NSError *err) { if ([(NSHTTPURLResponse *)res statusCode] == 200) { // NSLog(@"success"); } }]; } @end
  • 12. (Blocks) @interface Downloader : NSObject { NSOperationQueue *queue; } @end @implementation Downloader - (void)sendRequest { queue = [[NSOperationQueue alloc] init]; NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com/"]]; // [NSURLConnection sendAsynchronousRequest:req queue:queue completionHandler:^(NSURLResponse *res, NSData *data, NSError *err) { if ([(NSHTTPURLResponse *)res statusCode] == 200) { // NSLog(@"success"); } }]; } @end !
  • 13. (GCD) JavaScript • JavaScript • • • • iOS • • •
  • 14. (GCD) iOS 4 • @interface FileReader : NSObject { NSString *fileContent; } @property (nonatomic, assign) id delegate; @end @implementation FileReader -(void)readFile:(NSString *)filename { [self performSelectorInBackground:@selector(readFileOnBackground:) withObject:filename]; } // -(void)readFileOnBackground:(NSString *)filename { NSError *err = nil; fileContent = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&err]; // UI [delegate performSelectorOnMainThread:@selector(updateViewWithFile:) withObject:fileContent waitUntilDone:NO]; } @end
  • 15. (GCD) iOS 4 • Grand Central Dispatch • • • • •
  • 16. (GCD) iOS 4 • @interface FileReader : NSObject @property (nonatomic, assign) id delegate; @end @implementation FileReader -(void)readFile:(NSString *)filename { // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ NSError *err = nil; NSString *fileContent = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&err]; // dispatch_async(dispatch_get_main_queue(), ^{ [delegate updateViewWithFile:fileContent]; }); }); } @end
  • 17. (ARC) JavaScript • GC • • Web
  • 18. (ARC) iOS 5 • @interface User : NSObject { NSString *name; NSString *imageUrl; } @end @implementation User -(id)initWithDictionary:(NSDictionary *)dict { self = [super init]; if (self) { name = [[dict objectForKey:@"name"] retain]; // imageUrl = [[dict objectForKey:@"image_url"] retain]; } return self; } // -(void)dealloc { [name release]; [imageUrl release]; [super dealloc]; } @end
  • 19. (ARC) iOS 5 • @interface User : NSObject { NSString *name; NSString *imageUrl; } @end @implementation User -(id)initWithDictionary:(NSDictionary *)dict { self = [super init]; if (self) { name = [[dict objectForKey:@"name"] retain]; // imageUrl = [[dict objectForKey:@"image_url"] retain]; } return self; } // -(void)dealloc { [name release]; [imageUrl release]; [super dealloc]; } @end
  • 20. (ARC) iOS 5 • Automatic Reference Counting • • • •
  • 21. (ARC) iOS 5 • ! @interface User : NSObject { NSString *name; NSString *imageUrl; } @end @implementation User -(id)initWithDictionary:(NSDictionary *)dict { self = [super init]; if (self) { name = [dict objectForKey:@"name"]; imageUrl = [dict objectForKey:@"image_url"]; } return self; } // @end
  • 22. GC • GC • iOS • • • CPU
  • 23. Objective-C JavaScript ! • … … • Objective-C • • iOS •