#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://api.iapp.co.th/qa-generator-th?text=%E0%B8%9C%E0%B8%A1%E0%B8%9E%E0%B8%B9%E0%B8%94%E0%B8%87%E0%B9%88%E0%B8%A7%E0%B8%87%E0%B8%A1%E0%B8%B2%E0%B8%81&apikey=eufbCBjpYMaNbComOEycc52rX6ZqhbbN"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
dispatch_semaphore_signal(sema);
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);