This is my code, i print the address, and when I enter address from NSLOG in browser, it shows desired data, but in my code, there is error.
+(void)getCityInformationByCityName:(NSString *)namer
successBlock:(void (^)(NSDictionary *response))successHandler
errorBlock:(void (^) (NSDictionary *error))errorHandler
{
NSString *apiKey = [[NSUserDefaults standardUserDefaults] objectForKey:@"apiKey"];
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
NSString *url = [NSString stringWithFormat:@"api.openweathermap.org/data/2.5/weather?q=%@&APPID=%@", namer, apiKey];
NSLog(@"%@", url);
[manager GET:url parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
successHandler(responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSDictionary *userInfo = [error userInfo];
errorHandler(userInfo);
}];
}
SOLVED: Replaced api, with https://
SOLVED: Replaced api, with https://