SlideShare a Scribd company logo
1 of 21
Download to read offline
iPhone
         id:ninjinkun / @ninjinkun
•            iOS Advent Calendar

    •   25

    •   http://atnd.org/events/22792
    •   http://ninjinkun.hatenablog.com/entry/2011/12/23/224918
•
•
•
•           IO→

    •                    etc…

•           IO→

•   iPhone

    •
        •         etc…

    •
•   …
•   …
•   Mail
•   Instagram
•   Facebook
•   Path
Mail

 •
 •

       •   OS

 •
 •
Instagram

 •
 •
     •
 •
 •
Facebook

 •
 •
Path

 •
 •
 •     POST / GET   (?)

 •
 •
 •                    …
•
    •   UIAlertView
•
    •   UIViewController

    •
    https://github.com/ninjinkun/AlertResume
•   UIAlertView
•   NSError

•   NSAlertView   NSError


    •   …
•   NSError


•       userInfo


•   localizedDiscription
•   localizedFailureReason
•   localizedRecoverySuggestion
•   localizedRecoveryOptions
NSArray *buttons = [NSArray arrayWithObjects:@"        ", @"        ", nil];
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
                          @"                           ", NSLocalizedDescriptionKey,
                          @”                       ”, NSLocalizedFailureReasonErrorKey,
                          @"           …", NSLocalizedRecoverySuggestionErrorKey,
                          buttons, NSLocalizedRecoveryOptionsErrorKey,
                          nil];
NSError*error = [NSError errorWithDomain:@"com.hoge.fuga" code:100 userInfo:userInfo];
•    UIAlertView
@implementation UIAlertView (NSErrorAddition)

-(id)initWithError:(NSError *)error {
    self = [super init];
    if (self) {
        self.title = [error localizedDescription];
        self.message = [[NSArray arrayWithObjects:[error localizedFailureReason],
            [error localizedRecoverySuggestion], nil] componentsJoinedByString:@"n"];
        NSArray* optionTitles = [error localizedRecoveryOptions];
        for (NSString *title in optionTitles) {
            [self addButtonWithTitle:title];
        }
    }
    return self;
}

@end
•   ViewController

    •   POST

    •
•                    ViewController
•
    •
    •
    •
•
•
    •
•
    •   Path

•
    •   UIAlertView
    •                 2

•
•   iOS       2

    •     ,

More Related Content

What's hot

Интуит. Разработка приложений для iOS. Лекция 11. Расширенные возможности уст...
Интуит. Разработка приложений для iOS. Лекция 11. Расширенные возможности уст...Интуит. Разработка приложений для iOS. Лекция 11. Расширенные возможности уст...
Интуит. Разработка приложений для iOS. Лекция 11. Расширенные возможности уст...
Глеб Тарасов
 
Corporate Council on Africa Infrastructure Conference, Washington, DC, Septem...
Corporate Council on Africa Infrastructure Conference, Washington, DC, Septem...Corporate Council on Africa Infrastructure Conference, Washington, DC, Septem...
Corporate Council on Africa Infrastructure Conference, Washington, DC, Septem...
lucamazzei
 

What's hot (13)

OE 42 boycott of virani moti's shantidas bapu for pro satpanth activities
OE 42  boycott of virani moti's shantidas bapu for pro satpanth activitiesOE 42  boycott of virani moti's shantidas bapu for pro satpanth activities
OE 42 boycott of virani moti's shantidas bapu for pro satpanth activities
 
Migrare da symfony 1 a Symfony2
 Migrare da symfony 1 a Symfony2  Migrare da symfony 1 a Symfony2
Migrare da symfony 1 a Symfony2
 
Whatisspider
WhatisspiderWhatisspider
Whatisspider
 
Crowdsourcing with Django
Crowdsourcing with DjangoCrowdsourcing with Django
Crowdsourcing with Django
 
If songs were lines in a conversation. Nick Drake
If songs were lines in a conversation. Nick DrakeIf songs were lines in a conversation. Nick Drake
If songs were lines in a conversation. Nick Drake
 
Blog Indiana09
Blog Indiana09Blog Indiana09
Blog Indiana09
 
Importance of ipad stands that seem trivial
Importance of ipad stands that seem trivialImportance of ipad stands that seem trivial
Importance of ipad stands that seem trivial
 
Интуит. Разработка приложений для iOS. Лекция 11. Расширенные возможности уст...
Интуит. Разработка приложений для iOS. Лекция 11. Расширенные возможности уст...Интуит. Разработка приложений для iOS. Лекция 11. Расширенные возможности уст...
Интуит. Разработка приложений для iOS. Лекция 11. Расширенные возможности уст...
 
Erik mogensen stowe
Erik mogensen stoweErik mogensen stowe
Erik mogensen stowe
 
A re introduction to webpack - reactfoo - mumbai
A re introduction to webpack - reactfoo - mumbaiA re introduction to webpack - reactfoo - mumbai
A re introduction to webpack - reactfoo - mumbai
 
When solid met angular components
When solid met angular componentsWhen solid met angular components
When solid met angular components
 
Corporate Council on Africa Infrastructure Conference, Washington, DC, Septem...
Corporate Council on Africa Infrastructure Conference, Washington, DC, Septem...Corporate Council on Africa Infrastructure Conference, Washington, DC, Septem...
Corporate Council on Africa Infrastructure Conference, Washington, DC, Septem...
 
A piece of sugar in your client-side development
A piece of sugar in your client-side developmentA piece of sugar in your client-side development
A piece of sugar in your client-side development
 

Viewers also liked

Amazon ElastiCache - AWSマイスターシリーズ
Amazon ElastiCache - AWSマイスターシリーズAmazon ElastiCache - AWSマイスターシリーズ
Amazon ElastiCache - AWSマイスターシリーズ
SORACOM, INC
 

Viewers also liked (8)

HTML5最新動向
HTML5最新動向HTML5最新動向
HTML5最新動向
 
NTT研究所におけるYammerの取り組みと、社内Twitterの統計解析
NTT研究所におけるYammerの取り組みと、社内Twitterの統計解析NTT研究所におけるYammerの取り組みと、社内Twitterの統計解析
NTT研究所におけるYammerの取り組みと、社内Twitterの統計解析
 
HTML5とはなにか?マイクロソフトはHTML5をどう考えているのか?
HTML5とはなにか?マイクロソフトはHTML5をどう考えているのか?HTML5とはなにか?マイクロソフトはHTML5をどう考えているのか?
HTML5とはなにか?マイクロソフトはHTML5をどう考えているのか?
 
ソーシャルゲームにおけるMongoDB適用事例 - Animal Land
ソーシャルゲームにおけるMongoDB適用事例 - Animal LandソーシャルゲームにおけるMongoDB適用事例 - Animal Land
ソーシャルゲームにおけるMongoDB適用事例 - Animal Land
 
Metro#1
Metro#1Metro#1
Metro#1
 
Amazon ElastiCache - AWSマイスターシリーズ
Amazon ElastiCache - AWSマイスターシリーズAmazon ElastiCache - AWSマイスターシリーズ
Amazon ElastiCache - AWSマイスターシリーズ
 
Web Intents入門
Web Intents入門Web Intents入門
Web Intents入門
 
Process Framework「CYCLONE for Mobile Apps」(20120118)
Process Framework「CYCLONE for Mobile Apps」(20120118)Process Framework「CYCLONE for Mobile Apps」(20120118)
Process Framework「CYCLONE for Mobile Apps」(20120118)
 

Similar to I phoneアプリの通信エラー処理

ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマー
Satoshi Asano
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical Stuff
Petr Dvorak
 
Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C Survives
S Akai
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
Ignacio Martín
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
Taro Matsuzawa
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
Petr Dvorak
 

Similar to I phoneアプリの通信エラー処理 (20)

ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマー
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical Stuff
 
iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev intro
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone development
 
Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C Survives
 
コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applications
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
 
Objective-C Crash Course for Web Developers
Objective-C Crash Course for Web DevelopersObjective-C Crash Course for Web Developers
Objective-C Crash Course for Web Developers
 
Thinking Outside The [Sand]Box
Thinking Outside The [Sand]BoxThinking Outside The [Sand]Box
Thinking Outside The [Sand]Box
 
Google Analytics & iPhone
Google Analytics & iPhoneGoogle Analytics & iPhone
Google Analytics & iPhone
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
 
Try EarlGrey | 20161118 iOS Test Night
Try EarlGrey | 20161118 iOS Test NightTry EarlGrey | 20161118 iOS Test Night
Try EarlGrey | 20161118 iOS Test Night
 
Selenium再入門
Selenium再入門Selenium再入門
Selenium再入門
 
Modernizes your objective C - Oliviero
Modernizes your objective C - OlivieroModernizes your objective C - Oliviero
Modernizes your objective C - Oliviero
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOS
 
Webエンジニアから見たiOS5
Webエンジニアから見たiOS5Webエンジニアから見たiOS5
Webエンジニアから見たiOS5
 
Freebase and the iPhone
Freebase and the iPhoneFreebase and the iPhone
Freebase and the iPhone
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++
 

More from Satoshi Asano (8)

GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
 
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
 
iPhoneアプリ開発講座Web連携アプリ編
iPhoneアプリ開発講座Web連携アプリ編iPhoneアプリ開発講座Web連携アプリ編
iPhoneアプリ開発講座Web連携アプリ編
 
Asihttp requestについて
Asihttp requestについてAsihttp requestについて
Asihttp requestについて
 
バックグラウンド位置取得について
バックグラウンド位置取得についてバックグラウンド位置取得について
バックグラウンド位置取得について
 
iPhoneアプリ開発講座入門編
iPhoneアプリ開発講座入門編iPhoneアプリ開発講座入門編
iPhoneアプリ開発講座入門編
 
集合知プログラミング第2章復習
集合知プログラミング第2章復習集合知プログラミング第2章復習
集合知プログラミング第2章復習
 
Algorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-TreeAlgorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-Tree
 

Recently uploaded

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
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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 ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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 - 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...
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

I phoneアプリの通信エラー処理

  • 1. iPhone id:ninjinkun / @ninjinkun
  • 2. iOS Advent Calendar • 25 • http://atnd.org/events/22792 • http://ninjinkun.hatenablog.com/entry/2011/12/23/224918
  • 4. IO→ • etc… • IO→ • iPhone • • etc… •
  • 5.
  • 6.
  • 7.
  • 8. Mail • Instagram • Facebook • Path
  • 9. Mail • • • OS • •
  • 10. Instagram • • • • •
  • 12. Path • • • POST / GET (?) • • • …
  • 13. • UIAlertView • • UIViewController • https://github.com/ninjinkun/AlertResume
  • 14. UIAlertView • NSError • NSAlertView NSError • …
  • 15. NSError • userInfo • localizedDiscription • localizedFailureReason • localizedRecoverySuggestion • localizedRecoveryOptions
  • 16. NSArray *buttons = [NSArray arrayWithObjects:@" ", @" ", nil]; NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: @" ", NSLocalizedDescriptionKey, @” ”, NSLocalizedFailureReasonErrorKey, @" …", NSLocalizedRecoverySuggestionErrorKey, buttons, NSLocalizedRecoveryOptionsErrorKey, nil]; NSError*error = [NSError errorWithDomain:@"com.hoge.fuga" code:100 userInfo:userInfo];
  • 17. UIAlertView @implementation UIAlertView (NSErrorAddition) -(id)initWithError:(NSError *)error { self = [super init]; if (self) { self.title = [error localizedDescription]; self.message = [[NSArray arrayWithObjects:[error localizedFailureReason], [error localizedRecoverySuggestion], nil] componentsJoinedByString:@"n"]; NSArray* optionTitles = [error localizedRecoveryOptions]; for (NSString *title in optionTitles) { [self addButtonWithTitle:title]; } } return self; } @end
  • 18. ViewController • POST • • ViewController
  • 19. • • • •
  • 20. • • • Path • • UIAlertView • 2 •
  • 21. iOS 2 • ,