Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dutch FP Day 2015

Dutch FP Day 2015

Chris Eidhof | @chriseidhof

January 09, 2015
Tweet

More Decks by Chris Eidhof | @chriseidhof

Other Decks in Technology

Transcript

  1. - (NSDictionary*)parseResponse:(NSData*) data { NSString *dataString = [[NSString alloc] initWithData:data

    encoding:NSUTF8StringEncoding]; NSObject *json = [dataString JSONValue]; [dataString release]; if (json == nil || ![json isKindOfClass:[NSDictionary self]]) { return nil; } return (NSDictionary *)json; }
  2. + (BOOL)isHostReachable:(NSString *)host { if (!host || ![host length]) {

    return NO; } SCNetworkReachabilityFlags flags; SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [host UTF8String]); BOOL gotFlags = SCNetworkReachabilityGetFlags(reachability, &flags); CFRelease(reachability); if (!gotFlags) { return NO;
  3. OOP