List of countries and country dialing codes , country name and country icon objective c

ios objective-c

642 观看

1回复

1 作者的声誉

need to List of countries name , countries flag icon and country dialing codes in objective c for my IOS Apps . i want show all country name with flag and Country dialing code if any one please provide me because i am new in ios

作者: vikas 的来源 发布者: 2017 年 9 月 15 日

回应 1


2

3144 作者的声誉

You can get name, dialing code, icon , etc in Country list, Call this api, you will have a list of value as JSON form

 [[NSURLSession sharedSession] dataTaskWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://restcountries.eu/rest/v2/all"]]
                                         completionHandler:
     ^(NSData *data, NSURLResponse *response, NSError *error) {
         // ...
       //handle your data here
     }] resume];

Read Local JSON file

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Country" ofType:@"json"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSArray *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];

JSON file url https://drive.google.com/file/d/0B7iyUiCdVAr3ZVZKUEF4YVk4TFU/view?usp=sharing

drag file into your application and use it, if you dont want to use api.

作者: karthikeyan 发布者: 2017 年 9 月 15 日
32x32