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

4,298 views
4,298 views

Published on

Published in: Technology, Spiritual
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,298
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
8
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

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

  1. 1. iPhone id:ninjinkun / @ninjinkun
  2. 2. • iOS Advent Calendar • 25 • http://atnd.org/events/22792 • http://ninjinkun.hatenablog.com/entry/2011/12/23/224918
  3. 3. •••
  4. 4. • IO→ • etc…• IO→• iPhone • • etc… •
  5. 5. • …
  6. 6. • …
  7. 7. • Mail• Instagram• Facebook• Path
  8. 8. Mail • • • OS • •
  9. 9. Instagram • • • • •
  10. 10. Facebook • •
  11. 11. Path • • • POST / GET (?) • • • …
  12. 12. • • UIAlertView• • UIViewController • https://github.com/ninjinkun/AlertResume
  13. 13. • UIAlertView• NSError• NSAlertView NSError • …
  14. 14. • NSError• userInfo• localizedDiscription• localizedFailureReason• localizedRecoverySuggestion• localizedRecoveryOptions
  15. 15. 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];
  16. 16. • 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
  17. 17. • ViewController • POST •• ViewController
  18. 18. • • • ••
  19. 19. • •• • Path• • UIAlertView • 2•
  20. 20. • iOS 2 • ,

×