iBeacon Receiver is not recognising the transmitted signal - ios

I am working on iBeacon transmitter and receiver. I have successfully completed the transmitter part but the other part the receiver is not recognising the transmitted signal. Can any body please help me identify where i went wrong? Is there anything more I have to add in .plist. I have tried stackoverflow answers but sorry to tell that nothing worked.
#import "ViewController.h"
#interface ViewController ()
#end
#implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Initialize location manager and set ourselves as the delegate
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
// Create a NSUUID with the same UUID as the broadcasting beacon
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:#"A77A1B68-49A7-4DBF-914C-760D07FBB87B"];
// Setup a new region with that UUID and same identifier as the broadcasting beacon
self.myBeaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:#"xx.xxxxxx.xxxxxxxx"];
// Tell location manager to start monitoring for the beacon region
[self.locationManager startMonitoringForRegion:self.myBeaconRegion];
// Check if beacon monitoring is available for this device
if (![CLLocationManager isMonitoringAvailableForClass:[CLBeaconRegion class]]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Monitoring not available" message:nil delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles: nil];
[alert show];
return;
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)locationManager:(CLLocationManager*)manager didEnterRegion:(CLRegion *)region
{
// We entered a region, now start looking for our target beacons!
self.statusLabel.text = #"Finding beacons.";
[self.locationManager startRangingBeaconsInRegion:self.myBeaconRegion];
}
-(void)locationManager:(CLLocationManager*)manager didExitRegion:(CLRegion *)region
{
// Exited the region
self.statusLabel.text = #"None found.";
[self.locationManager stopRangingBeaconsInRegion:self.myBeaconRegion];
}
-(void)locationManager:(CLLocationManager*)manager
didRangeBeacons:(NSArray*)beacons
inRegion:(CLBeaconRegion*)region
{
// Beacon found!
self.statusLabel.text = #"Beacon found!";
CLBeacon *foundBeacon = [beacons firstObject];
// You can retrieve the beacon data from its properties
//NSString *uuid = foundBeacon.proximityUUID.UUIDString;
//NSString *major = [NSString stringWithFormat:#"%#", foundBeacon.major];
//NSString *minor = [NSString stringWithFormat:#"%#", foundBeacon.minor];
}
#end

You need to ask the permission to use the bluetooth.
Use requestAlwaysAuthorization (for background location) or requestWhenInUseAuthorization (when foreground).
You also need the NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription key in Info.plist with a message to be displayed in the prompt to the user like "I need your permission to access bluetooth" or whatever.

In previous system versions, it will automatically notify the user to authorize when the location service is being used. In iOS 8, Apple has updated the authorization strategy, which requires to call the function to request user's authorization. The corresponding SDK has also provided alternative function.
1.requestAlwaysAuthorization
Firstly, the notification content is required. When calling the function, the system will push this paragraph of text to the user if he/she has not authorize the App to use the service. You may need to add the following key to Info.plist:
NSLocationAlwaysUsageDescription
Meanwhile, a written desciption should be added, without which calling the function will be invalid. Secondly, call the authorization function.
[locationManger requestAlwaysAuthorization];

Just a side thought to try and debug the issue (Although from your code everything seems to be written correctly).
First, lets see if you got some error while initialising your listener. To do that, lets implement these delegates and see if you get some error here:
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
- (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error
Second, implement below delegate to check if location manager started monitoring your region. You can NSLog your region' UUID and identifier just to be doubly sure.
- (void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region
Next, if you get above call back then everything seems fine on your listener. Try couple of things now:
Is your broadcaster is really broadcasting?
If yes, is it broadcasting the same UUID your listener is expecting.
If yes, try switching off listener and broadcaster. Reboot the device and then switch on broadcaster followed by listener.
I have experienced, Location management not work instantaneously. For instance, once you detected the region entry, if you got out of the region you may not get immediate call back and then if you enter the same region again without getting exit call, you will not receive entry call. I've seen #3, working in many situations.
Also, a tip that I am not remembering where I got from :). Start ranging your beacons along with monitoring. Sometimes this gives better results.

Related

iOS app rejected - Your app enables the display of nearby users' locations on a map, but does not have the required privacy precautions in place

My iOS app rejected from apple due to following reason :-
Your app enables the display of nearby users' locations on a map, but
does not have the required privacy precautions in place.
And they are sharing this screenshot of my app with rejection message.
In my app, I am using user’s location for showing near by events on the Map. Also I have enabled option showing user’s location on the Map.
I am using following code for setting up location services into my app.
//Declarting objects in .h file
CLGeocoder *geocoder;
CLPlacemark *placemark;
#property (nonatomic,retain) CLLocationManager *locationManager;
//Calling this method from viewDidLoad for setup location services..
-(void)getUserCurrentLocation
{
geocoder = [[CLGeocoder alloc] init];
self.locationManager=[[CLLocationManager alloc]init];
self.locationManager.delegate=self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
_locationManager.distanceFilter=kCLDistanceFilterNone;
if ([_locationManager respondsToSelector:#selector(requestWhenInUseAuthorization)])
{
[_locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];
}
-(void)StopUpdateLOcation
{
if([CLLocationManager locationServicesEnabled])
{
[self.locationManager stopUpdatingLocation];
}
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLLocation *currentLocation = newLocation;
if (currentLocation != nil)
{
//Saving location
[USERDEFAULT setValue:[NSNumber numberWithFloat:currentLocation.coordinate.latitude] forKey:#"CurrentLocationLatitude"];
[USERDEFAULT setValue:[NSNumber numberWithFloat:currentLocation.coordinate.longitude] forKey:#"CurrentLocationLongitude"];
//Here reverseGeocodeLocation method for fetching address from location
[self StopUpdateLOcation];
}
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(#"didFailWithError: %#", error);
}
Also I have added property “Privacy - Location When In Use Usage Description” with proper message. Also I have disabled the location service when got the location.
Not sure, why they are rejecting app. Did I miss something.?
How can I resolved this issue.?
Any help would be appreciated.
Finally, Got the proper solution for this. Thanks #Anbu.kartik for helping to findout this solution.
I have enabled the option for showing user’s location on the MAP. but didn’t wrote the failure delegate methods for handling, if user’s location not found.
So I write following delegate methods and send an app for approval again. And the app is approved by apple.
- (void)mapView:(MKMapView *)mapView didFailToLocateUserWithError:(NSError *)error{
NSLog(#"didFailToLocateUserWithError %#", error.description);
}
- (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error{
NSLog(#"mapViewDidFailLoadingMap %#", error.description);
}
So we must have to write failure delegates for handling errors for all the functionalities. So never happens rejection of app related this type of issues.
Hope, this is what you're looking for. Any concern get back to me. :)
Have you added this message to iTunes store description:
Continued use of GPS running in the background can dramatically
decrease battery life.
e.g: check the last line in Google Maps description:
https://itunes.apple.com/us/app/google-maps-navigation-transit/id585027354?mt=8

Cllocationmanager Didupdatelocation delegate not getting called without internet

I am currently working on a location based ios application. I am using didupdatelocation delegate method for showing user's current location. It works fine when I connect my device to internet. But when I disconnect the internet, it behaves strange and didupdatelocation is not getting called further. Please give a solution.
EDITED with code details
- (void)viewDidLoad
{
[super viewDidLoad];
locationManager = [[CLLocationManager alloc]init]; // initializing locationManager
locationManager.delegate = self; // we set the delegate of locationManager to self.
locationManager.desiredAccuracy = kCLLocationAccuracyBest; // setting the accuracy
[locationManager startUpdatingLocation]; //requesting location updates
}
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
UIAlertView *errorAlert = [[UIAlertView alloc]initWithTitle:#"Error" message:#"There was an error retrieving your location" delegate:nil cancelButtonTitle:#"OK" otherButtonTitles: nil];
[errorAlert show];
NSLog(#"Error: %#",error.description);
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *crnLoc = [locations lastObject];
latitude.text = [NSString stringWithFormat:#"%.8f",crnLoc.coordinate.latitude];
longitude.text = [NSString stringWithFormat:#"%.8f",crnLoc.coordinate.longitude];
altitude.text = [NSString stringWithFormat:#"%.0f m",crnLoc.altitude];
speed.text = [NSString stringWithFormat:#"%.1f m/s", crnLoc.speed];
}
#ANSHAD per your comment, if you are using an older iPad without GPS, the only way you can get location data is with WiFi so if you turn off WiFi, you will not get location updates. If you want GPS without WiFi you can buy an external GPS module see here
You can use the base GPS of the iPhone which works without the internet too. To access it you need to use the CoreLocation framework.
You can refer to this : CoreLocation methods to use the GPS data.
Let me know if any other help required.

CLLocationManager startUpdatingLocation not calling locationManager:didUpdateLocations: or locationManager:didFailWithError:

I'm trying to use the CLLocationManager framework in my iOS project to access the user's location but when I call
[locationManager startUpdatingLocation]
neither locationManager:didUpdateLocations: or locationManager:didFailWithError: are getting called.
//myViewController.h
#interface myViewController : UITableViewController <CLLocationManagerDelegate>
#end
//myViewController.m
#implementation myViewController{
CLLocationManager *locationManager;
}
//edit
- (void)viewDidLoad
{
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
}
//finish edit
-(void)getLocation
{
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:#"Error"
message:#"Failed to Get Your Location"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[errorAlert show];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *newLocation = locations[[locations count] -1];
CLLocation *currentLocation = newLocation;
NSString *longitude = [NSString stringWithFormat:#"%.8f", currentLocation.coordinate.longitude];
NSString *latitude = [NSString stringWithFormat:#"%.8f", currentLocation.coordinate.latitude];
if (currentLocation != nil) {
NSLog(#"latitude: %#", latitude);
NSLog(#"longitude: #"%#", longitude);
}else {
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:#"Error" message:#"Failed to Get Your Location"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[errorAlert show];
}
}
#end
Neither delegate method is being called despite what it says in the documentation:
"This method returns immediately. Calling this method causes the location manager to obtain an initial location fix (which may take several seconds) and notify your delegate by calling its locationManager:didUpdateLocations: method [...] In addition to your delegate object implementing the locationManager:didUpdateLocations: method, it should also implement the locationManager:didFailWithError: method to respond to potential errors."
Don't know how to debug the issue.
Thanks,
JA
Just add this in info.plist
NSLocationAlwaysUsageDescription --- I need Location
NSLocationWhenInUseUsageDescription --- I need Location
privacy - location usage description --- I need Location
Note that "I need Location" should be changed to describe your actual app's designed usage. It is communicated to the end user in the authorization message. (thanks #devios1)
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate=self;
locationManager.desiredAccuracy=kCLLocationAccuracyBest;
locationManager.distanceFilter=kCLDistanceFilterNone;
[locationManager requestWhenInUseAuthorization];
[locationManager startMonitoringSignificantLocationChanges];
[locationManager startUpdatingLocation];
Now it will call your didUpdateToLocation definitely.
for more details click here
You strongly need to check that you initialize CLLocationManager on main thread.
In other case you will not get updateLocation event.
I can't find such info in Apple docs but it works for me anyway.
Location Services work a bit differently starting in iOS 8.
Mainly, you need to add a key NSLocationWhenInUseUsageDescription to your Info.plist file, and add a description why your app need Location, such as "Location needed to ...".
Note that you might also have to check for iOS version. Only iOS 8 and up have the Location Manager listen to the requestWhenInUseAuthorization call.
The link below shows more details:
http://nevan.net/2014/09/core-location-manager-changes-in-ios-8/
Good luck!
With iOS 8.0 you need to call -[CLLocationManager requestWhenInUseAuthorization
] or -[CLLocationManager requestAlwaysAuthorization] first so the user gets asked to give your app permission to use the location.
You need to add below things to your project,
In plist of your project add these things:
Key: NSLocationAlwaysUsageDescription Type:String
Key: NSLocationWhenInUseUsageDescription Type:String
In the .m file with [locationManager startUpdatingLocation] add this condition :
if([locationManager respondsToSelector:#selector(requestAlwaysAuthorization)])
[locationManager requestAlwaysAuthorization];`
Then only your CLLocationManager delegate methods will get called.
I think you should check this link.You are not retaining the location manager object when declaring.
please give property to you object
#property(nonatomic, strong)
Why the CLLocationManager delegate is not getting called in iPhone SDK 4.0?
So if you are running in simulator don't forget to set location in simulator menu. It looks like if it is set to none nothing is called in delegate... I am not sure than if this can happen on real device too but probably it's simulator specific.
I had the following in my code base:
-(void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if( status == kCLAuthorizationStatusAuthorizedAlways ) {
_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
_locationManager.distanceFilter = 200;
}
}
Turns out that this was getting called in an infinite loop, because initializing a locationManager triggers this method for some reason? I had not realized that. I had put it there to catch when permissions were granted. Instead, I set up a location manager and started updating the location, but then this fired and replaced it with one that wasn't updating the location, and kept looping over and over.
Solution for me was just to add && !_locationManager to the if condition.

How to get beacon major and minor id in didExitRegion

I have created a iphone app for beacons. In that i want to display the message when i am exit from all the beacons region.
I dont want to display the message for every beacon exit region. For example, If have 3 beacons, I want to display the message only when i am exit of all the 3 beacons. Is it possible to do that?
And also i want to get the exiting beacon major and minor values in didExitRegion
I used the following code:
-(void)locationManager:(CLLocationManager*)manager
didRangeBeacons:(NSArray*)beacons
inRegion:(CLBeaconRegion*)region
{
// Beacon found!
NSLog(#"iBeacons found");
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Successfully found" message:nil delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles: nil]; [alert show];
CLBeacon *foundBeacon = [beacons firstObject];
// You can retrieve the beacon data from its properties
NSString *uuid = foundBeacon.proximityUUID.UUIDString;
NSString *majorId = [NSString stringWithFormat:#"%#", foundBeacon.major];
NSString *minorId = [NSString stringWithFormat:#"%#", foundBeacon.minor];
NSLog(#"UUID: %#", uuid);
}
In the above code i can get the uuid, major, minor of the beacons. But I want to get the values of the exiting beacon in didExitRegion. Is it possible?
Thanks in advance.
Use a mutable array to keep track of the region details of the detected beacon. And update that array with detection of new beacon regions. Like the code below
In delegate method didDetermineState add
- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region
{
if(state == CLRegionStateInside)
{
[regions addObject:region]; // regions is the mutable array
}
}
And with didExitRegion method add
// Tells the delegate that the user left the specified region.
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
[regions removeObject:region];
CLBeaconRegion *beaconRegion = (CLBeaconRegion *)region;
NSLog(#"\nExited region id: %#",beaconRegion.identifier);
NSLog(#"\nExited region major: %#",beaconRegion.major);
NSLog(#"\nExited region minor: %#",beaconRegion.minor);
// Add a check with regions array here to show the custom alert message
}
I dont want to display the message for every beacon exit region. For
example, If have 3 beacons, I want to display the message only when i
am exit of all the 3 beacons. Is it possible to do that?
Your requirements don't seem completely clear. If these three beacons are described by a single region you're monitoring, then it's simple: you will only get a single didExitRegion: message as you leave the range of the last beacon in the region. Otherwise, Alex's suggestion above seems reasonable: track regions you're entering and exiting, then conditionally execute some code in didExitRegion: when the count of regions you're currently in drops to zero.
And also i want to get the exiting beacon major and minor values in
didExitRegion
I'm not sure "exiting beacon" is well-defined here (do you mean, say, the last beacon in the region whose range you left, hence triggering the didExitRegion: message?), but in any case you can't get what you're asking for here. Where Alex logs major and minor, they are attributes of the region being monitored (and, in this case, being exited), not of any specific beacon.

Why doesn't it find my beacons?

I am writing both Android and iOS apps which need to find BLE beacons around the device.
When I run my code from Android, it finds several beacons in the room I am in.
I have 8 beacons.
When I run the beacon code from iPhone, it returns a list of exactly 0 beacons.
Here is my code:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self initRegion];
[self locationManager:self.locationManager didStartMonitoringForRegion:self.beaconRegion];
}
- (void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region {
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
}
- (void)initRegion {
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:BEACONUUID];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:BEACONIDENTIFIER];
[self.locationManager startMonitoringForRegion:self.beaconRegion];
}
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
NSLog(#"Beacon Found");
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
}
-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
NSLog(#"Left Region");
[self.locationManager stopRangingBeaconsInRegion:self.beaconRegion];
self.beaconFoundLabel.text = #"No";
}
-(void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region {
CLBeacon *beacon = [beacons lastObject];//<== is always 0
self.beaconFoundLabel.text = #"Yes";
self.proximityUUIDLabel.text = beacon.proximityUUID.UUIDString;
self.majorLabel.text = [NSString stringWithFormat:#"%#", beacon.major];
self.minorLabel.text = [NSString stringWithFormat:#"%#", beacon.minor];
self.accuracyLabel.text = [NSString stringWithFormat:#"%f", beacon.accuracy];
if (beacon.proximity == CLProximityUnknown) {
self.distanceLabel.text = #"Unknown Proximity";
} else if (beacon.proximity == CLProximityImmediate) {
self.distanceLabel.text = #"Immediate";
} else if (beacon.proximity == CLProximityNear) {
self.distanceLabel.text = #"Near";
} else if (beacon.proximity == CLProximityFar) {
self.distanceLabel.text = #"Far";
}
self.rssiLabel.text = [NSString stringWithFormat:#"%ld", (long)beacon.rssi];
}
In my didRangeBeaconsInRegion, the beacons NSArray always comes up with 0 objects.
Though I have 8 objects. And i've downloaded several apps that are not mine, and they all see several of my beacons.
Why doesn't my code see any of my beacons?
Here is what I do whenever I'm setting up an iBeacon app.
Not all these things are necessary, but it will
work
keep your user happy
(maybe most importantly) keep Apple happy
iOS 8+ Only
First things first: if you're using iOS 8, you need to make sure you actually have access before using CLLocationManager.
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
// You can either use requestAlwaysAuthorization, or requestWhenInUseAuthorization
[self.locationManager requestAlwaysAuthorization];
You'll also need an entry for NSLocationAlwaysUsageDescription in your plist (again, iOS 8 only )
iOS 7+
Your App's pList
Regardless you're using iOS 8 or 7, you should add the following to your plist file (you need to decide if you'll use background or not).
Note: The below is in the form of KEY : KEY TYPE : VALUE for string, and KEY : KEY TYPE : [ Value1, Value2... ] for Arrays:
NSLocationUsageDescription : String : "Gimmie access to your location or else..."
NSBluetoothPeripheralUsageDescription : String : "Gimmie access to your blue tooth or else"
// Optionally supply if you need background modes. I don't believe you need this either if you plan to turn these options on using the Capabilities section of your App's Settings (see below section)
UIBackgroundModes : Array : [ location, bluetooth-central ]
UIApplicationExitsOnSuspend : Boolean : NO
Your App's Project Settings (Capabilities)
this section has been removed as this can cause your app to be rejected (as noted by #heypiotr in the comments)
Final Thoughts
A final suggestion would be to try moving [self locationManager:self.locationManager didStartMonitoringForRegion:self.beaconRegion] into your viewDidAppear.
Here is an example of what I typically do ( which works quite well for me ).
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self initLocationManager];
[self initBeaconRegion];
[self startMonitoring];
}
-(void)initLocationManager {
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
// Not necessary, but I like to do it.
if( ![CLLocationManager locationServicesEnabled] ) {
[self.locationManager startUpdatingLocation];
}
// Only necessary if you're in iOS 8. Checking for existence though to support iOS 7
if( ![CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized ) {
if ([CLLocationManager respondsToSelector:#selector(requestAlwaysAuthorization)]) {
[self.locationManager performSelector:#selector( requestAlwaysAuthorization )];
}
}
}
-(void)initBeaconRegion {
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:kYOUR_UUID_HERE];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:kYOUR_IDENTIFIER_HERE];
// Change this to whatever you want....
self.beaconRegion.notifyEntryStateOnDisplay = YES;
self.beaconRegion.notifyOnEntry = NO;
self.beaconRegion.notifyOnExit = YES;
}
# pragma mark -
# pragma mark Monitoring Beacons
# pragma mark -
-(void)startMonitoring {
// Monitor Beacon signals around me and report them back to me
[self.locationManager startMonitoringForRegion:self.beaconRegion];
}
The last part ( placement in viewDidAppear ) may or may not help - it all depends I guess on too many factors to consider in a stackoverflow response.
Hope that helps and good luck!
Final Edit
Forgot one more thing that may help. There are some helpful methods that you can implement that can help you debug the issue further. Here is an example of a few of them:
#pragma mark Authorization Status Changed
-(void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if( ![CLLocationManager locationServicesEnabled] ) {
NSLog(#"Couldn't turn on ranging: Location services are not enabled.");
} else {
NSLog(#"Location services ARE enabled.");
}
if( [CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized ) {
NSLog(#"Couldn't turn on monitoring: Location services not authorized.");
} else {
NSLog(#"Location services ARE authorized.");
}
}
#pragma mark -
#pragma mark CLLocationManager Errors
#pragma mark -
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
NSLog( #"FAIL ERROR: %#", [error description] );
}
-(void)locationManager:(CLLocationManager *)manager rangingBeaconsDidFailForRegion (CLBeaconRegion *)region withError:(NSError *)error {
NSLog( #"RANGE BEACONS ERROR: %#", [error description] );
}
First check with the other app like.Locate app add your UDID and check this app is showing your iBeacon. if not then there is a problem with apple IOS sometimes. then remove the app. Restart the app. it will work for you.
We had similar problem before, make sure your iBeacon device respond the scan request from iOS with a response DOES not contain manufacturer specific field.
Please check this note from apple
Before attempting to monitor any regions, your app should check whether region monitoring is supported on the current device. Here are some reasons why region monitoring might not be available:
The device doesn’t have the necessary hardware to support region
monitoring.
The user denied the app the authorization to use region monitoring.
The user disabled location services in the Settings app.
The user disabled Background App Refresh in the Settings app, either for the device or for your app.
5.The device is in Airplane mode and can’t power up the necessary hardware.
In iOS 7.0 and later, always call the isMonitoringAvailableForClass: and authorizationStatus class methods of CLLocationManager before attempting to monitor regions. (In OS X v10.8 and later and in previous versions of iOS, use the regionMonitoringAvailable class instead.) The isMonitoringAvailableForClass: method tells you whether the underlying hardware supports region monitoring for the specified class at all. If that method returns NO, your app can’t use region monitoring on the device. If it returns YES, call the authorizationStatus method to determine whether the app is currently authorized to use location services. If the authorization status is kCLAuthorizationStatusAuthorized, your app can receive boundary crossing notifications for any regions it registered. If the authorization status is set to any other value, the app doesn’t receive those notifications.
Apple link goes here

Resources