Skip to content

Files

Latest commit

 

History

History
19 lines (15 loc) · 832 Bytes

README.md

File metadata and controls

19 lines (15 loc) · 832 Bytes

APIRequest

-(void)showLocaiton { NSString *urlString = [NSString stringWithFormat:@"http://api.openweathermap.org/data/2.5/weather?id=%@", self.location]; NSURL *url = [NSURL URLWithString:urlString]; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];

NSData *data = [NSURLConnection sendSynchronousRequest:urlRequest
                                     returningResponse:nil
                                                 error:nil];
if (data != nil) {
    NSDictionary *weatherDict = [NSJSONSerialization JSONObjectWithData:data
                                                                options:NSJSONReadingMutableContainers
                                                                  error:nil];
   NSLog(@"%@", [weatherDict description]);
}

}