Hello,
When the device enters a region I want to do a webservice call to get the alert title of my local notification. But It seems it does not finish my method? You guys have any idea? Here is the code I use:
-
(void)beaconManager:(ESTBeaconManager *)manager didEnterRegion:(ESTBeaconRegion *)region
{
if([region.identifier isEqualToString:@"RegionIdentifier"]){
NSString *path = [NSString stringWithFormat:@"/webservice/ibeacon/get-beacon-news/apikey/%@/id/%@/language/nl",@"apikey123",@"1"];
NSURL *baseURL = [NSURL URLWithString:@"http://krc2014.preview.sanmax.be"];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];;[manager GET:path parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) { // Success NSDictionary *json = (NSDictionary *)responseObject; NSLog(@"JSON %@",json); int status = [[json valueForKey:@"status"] intValue]; if(status == 200){ UILocalNotification *notification = [UILocalNotification new]; notification.alertBody = [json valueForKeyPath:@"data.title"]; [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; }else{ } }failure:^(NSURLSessionDataTask *task, NSError *error) { // Failure NSLog(@"Failure: %@", error); }];
}
}