0

I have 2 devices, iPhone 5 (act as Beacon) and iPhone 5s (act as Beacon Detector), both with iOS 8.1.

Both device enabled:

  • Location Service ( Privacy > Location Service > Always for AirLocate )
  • Bluetooth
  • Wi-Fi, joining same SSID which has Internet connection (not quite related)
  • iPhone 5s has SIM card, with adequate signal strength
  • iPhone 5 has no SIM card

In iPhone 5, I installed Apple's AirLocate demo, and config as follow (In Configuration page):

  • Enabled: YES
  • UUID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
  • Major: 0
  • Minor: 0
  • Measured Power: -59

Since the original AirLocate is reported not working in iOS 8 by default, I modified the AppDelegate's didFinishLaunchingWithOptions with:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    // This location manager will be used to notify the user of region state transitions.
    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;
    if([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
        [self.locationManager requestAlwaysAuthorization];
    }

    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
        [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
    }
    return YES;
}

In iPhone 5s, I installed Beacon Demo and configure as follow (add a new Beacon):

  • Beacon UUID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
  • Major ID: (empty)
  • Minor ID: (empty)
  • Hello Message: Entry Testing
  • Goodbye Message: Bye Testing

However, the iPhone 5 does not show up in iPhone 5s, always claiming "Not In Range". What did I miss?


Screenshots:

Left: AirLocate; Right: Beacon Demo

Left: AirLocate; Right: Beacon Demo


Update Latest didFinishLaunchingWithOptions: in Beacon Demo

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Set up Core Location Manager
    self.coreLocation = [[CLLocationManager alloc] init];
    _coreLocation.delegate = self;
    if([self.coreLocation respondsToSelector:@selector(requestAlwaysAuthorization)]) {
        NSLog(@"Core Location requesting always authorization");
        [self.coreLocation requestAlwaysAuthorization];
    }
    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
        [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
    }

    // Load any previously registered notifications
    [self loadNotificationRegions];

    // Override point for customization after application launch.
    return YES;
}
Raptor
  • 53,206
  • 45
  • 230
  • 366
  • the modification you made to AirLocate is only necessary for using CoreLocation to scan for beacons. If you are using it as a transmitter, this is not needed. – davidgyoung Jan 09 '15 at 05:35
  • What if you use the AirLocate program on the 5s (modified as you described, but also adding the required key in the plist that goes with the requestAlwaysAuthorization). Does it detect the beacon transmission from the 5? – davidgyoung Jan 09 '15 at 05:36

1 Answers1

2

If you are using the version of Beacon Demo from here then you need to make the equivalent modification to it as you did to the AirLocate demo app. Neither app requests the necessary permissions added in iOS 8.

When you do this, make sure you also add a corresponding entry in the Info.plist file as described here.

Community
  • 1
  • 1
davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • the AirLocate App, if act as a Beacon, got picked up by another Android Beacon App, proven that it works perfectly. But after I added the entry in `Info.plist` in the Beacon Demo app, made the changes in App Delegate and Clean Rebuilt the App, the App still said the Beacon is not in range. How can I debug it? – Raptor Jan 09 '15 at 06:18
  • I also tried to change the identifier in AppDelegate in Beacon Demo App to `com.example.apple-samplecode.AirLocate` instead of `com.iotdesignshop.BeaconDemo` to align with AirLocate App. Still "Not In Range" – Raptor Jan 09 '15 at 06:41
  • Do you get a dialog prompting you for location access when first running beacon demo? If not sure, uninstall/reinstall and try again. You must get this dialog and respond Vin the affirmative fgoir it to work. – davidgyoung Jan 09 '15 at 14:00
  • I tried to uninstall, reboot, and re-install the Beacon Demo App. It does not request me for either Push Notification or Location Access. Maybe it's because I changed the App Delegate didFinishLaunchingWithOptions? See the question edit above for the latest edit. – Raptor Jan 12 '15 at 02:09
  • In further investigation, `monitoringDidFailForRegion:` reports error: *The operation couldn’t be completed. (kCLErrorDomain error 4.)* Access denied as told by [this post](http://stackoverflow.com/questions/21791862/how-do-i-enable-access-to-region-monitoring-service). How come? Investigation continues. – Raptor Jan 12 '15 at 07:14
  • Can you post your plist for BeaconDemo? Perhaps something is not right there. – davidgyoung Jan 12 '15 at 14:21
  • @davidyoung I finally discovered what I missed; I misspelled a key. Thanks, it's resolved now. – Raptor Jan 13 '15 at 02:26