SlideShare a Scribd company logo
1 of 23
Download to read offline
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

What's hot

Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web ServersTroy Miles
 
Logstash-Elasticsearch-Kibana
Logstash-Elasticsearch-KibanaLogstash-Elasticsearch-Kibana
Logstash-Elasticsearch-Kibanadknx01
 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebeanFaren faren
 
MongoDB: tips, trick and hacks
MongoDB: tips, trick and hacksMongoDB: tips, trick and hacks
MongoDB: tips, trick and hacksScott Hernandez
 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPAFaren faren
 
Introduction to reactive programming & ReactiveCocoa
Introduction to reactive programming & ReactiveCocoaIntroduction to reactive programming & ReactiveCocoa
Introduction to reactive programming & ReactiveCocoaFlorent Pillet
 
Solr Indexing and Analysis Tricks
Solr Indexing and Analysis TricksSolr Indexing and Analysis Tricks
Solr Indexing and Analysis TricksErik Hatcher
 
Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Jiayun Zhou
 
openstack源码分析(1)
openstack源码分析(1)openstack源码分析(1)
openstack源码分析(1)cannium
 
Debugging and Testing ES Systems
Debugging and Testing ES SystemsDebugging and Testing ES Systems
Debugging and Testing ES SystemsChris Birchall
 
MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015Mark Hemmings
 
How to create a libcloud driver from scratch
How to create a libcloud driver from scratchHow to create a libcloud driver from scratch
How to create a libcloud driver from scratchMike Muzurakis
 
How to create a libcloud driver from scratch
How to create a libcloud driver from scratchHow to create a libcloud driver from scratch
How to create a libcloud driver from scratchMist.io
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring ClojurescriptLuke Donnet
 

What's hot (20)

Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
 
Logstash-Elasticsearch-Kibana
Logstash-Elasticsearch-KibanaLogstash-Elasticsearch-Kibana
Logstash-Elasticsearch-Kibana
 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebean
 
MongoDB: tips, trick and hacks
MongoDB: tips, trick and hacksMongoDB: tips, trick and hacks
MongoDB: tips, trick and hacks
 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPA
 
Introduction to reactive programming & ReactiveCocoa
Introduction to reactive programming & ReactiveCocoaIntroduction to reactive programming & ReactiveCocoa
Introduction to reactive programming & ReactiveCocoa
 
Node.js - Best practices
Node.js  - Best practicesNode.js  - Best practices
Node.js - Best practices
 
Solr Indexing and Analysis Tricks
Solr Indexing and Analysis TricksSolr Indexing and Analysis Tricks
Solr Indexing and Analysis Tricks
 
Nginx-lua
Nginx-luaNginx-lua
Nginx-lua
 
Dockercompose
DockercomposeDockercompose
Dockercompose
 
Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015Akka Cluster in Java - JCConf 2015
Akka Cluster in Java - JCConf 2015
 
Elk stack
Elk stackElk stack
Elk stack
 
Scripting GeoServer
Scripting GeoServerScripting GeoServer
Scripting GeoServer
 
openstack源码分析(1)
openstack源码分析(1)openstack源码分析(1)
openstack源码分析(1)
 
Debugging and Testing ES Systems
Debugging and Testing ES SystemsDebugging and Testing ES Systems
Debugging and Testing ES Systems
 
MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015
 
How to create a libcloud driver from scratch
How to create a libcloud driver from scratchHow to create a libcloud driver from scratch
How to create a libcloud driver from scratch
 
How to create a libcloud driver from scratch
How to create a libcloud driver from scratchHow to create a libcloud driver from scratch
How to create a libcloud driver from scratch
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring Clojurescript
 
Go database/sql
Go database/sqlGo database/sql
Go database/sql
 

Viewers also liked

GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法Satoshi Asano
 
集合知プログラミング第2章復習
集合知プログラミング第2章復習集合知プログラミング第2章復習
集合知プログラミング第2章復習Satoshi Asano
 
インターン講義8日目「データ構造」
インターン講義8日目「データ構造」インターン講義8日目「データ構造」
インターン講義8日目「データ構造」Hatena::Engineering
 
Algorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-TreeAlgorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-TreeSatoshi Asano
 
趣味プロダクトで楽しいコードライフワークを送る
趣味プロダクトで楽しいコードライフワークを送る趣味プロダクトで楽しいコードライフワークを送る
趣味プロダクトで楽しいコードライフワークを送るvolpe_hd28v
 
機械学習で泣かないためのコード設計
機械学習で泣かないためのコード設計機械学習で泣かないためのコード設計
機械学習で泣かないためのコード設計Takahiro Kubo
 

Viewers also liked (9)

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

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

Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applicationslmrei
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCAWhymca
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical StuffPetr Dvorak
 
ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーSatoshi Asano
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Sarp Erdag
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
 
Full Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQLFull Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQLAll Things Open
 
Parse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksParse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksHector Ramos
 
iOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendiOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendStefano Zanetti
 
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"
MPD2011 | Сергей Клюев "RESTfull iOS with RestKit"ITGinGer
 
mobile in the cloud with diamonds. improved.
mobile in the cloud with diamonds. improved.mobile in the cloud with diamonds. improved.
mobile in the cloud with diamonds. improved.Oleg Shanyuk
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOSPetr Dvorak
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsPetr Dvorak
 
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Luigi Dell'Aquila
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
RESTfull with RestKit
RESTfull with RestKitRESTfull with RestKit
RESTfull with RestKitTaras Kalapun
 

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

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

More from Satoshi Asano

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

More from Satoshi Asano (7)

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

Recently uploaded

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 

Recently uploaded (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 

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 •