Estimote / iOS-Fleet-Management-SDK

Estimote Fleet Management SDK for iOS
https://developer.estimote.com
MIT License
1.18k stars 398 forks source link

App not detecting Region When being called in a CollectionViewCell #218

Closed myflokk closed 8 years ago

myflokk commented 8 years ago

I have a list of items in a collectionview. I assigned beacons UUID, major and minor to do different items in the collectionview. I am able to set the beacon region and call the action to start monitoring for the beacons but they are never detected. I have used the Estimote app to make sure the beacons were detectable and they are but they are not being recognized in my implementation. Could you assist?

`self.beaconManager.delegate = self let beaconRegion = CLBeaconRegion(proximityUUID: NSUUID(UUIDString: "(beacon.UUID!)")!, major: beacon.Major, minor: beacon.Minor, identifier: "my beacons") print(beaconRegion)

        print("Looking for beacon")
        //Set whether the beacon sends a notification when you enter or exit the beacon range
        beaconRegion.notifyOnEntry = true
        beaconRegion.notifyOnExit = true
        beaconRegion.notifyEntryStateOnDisplay = true

        // 4. We need to request this authorization for every beacon manager
        self.beaconManager.requestAlwaysAuthorization()

        self.beaconManager.startMonitoringForRegion(beaconRegion)
        //force ios to check for the state of the beacon range
        self.beaconManager.requestStateForRegion(beaconRegion)

`

` //func for when the person enters the range of a beacon func beaconManager(manager: AnyObject, didEnterRegion region: CLBeaconRegion) { let notification = UILocalNotification() let beacon = events.Beacons as! Beacons

    //Check Beacon table to see if the user has been checked in or not
    if !beacon.Flokkers.contains(User.currentUser()!.objectId!) {

        //if user has not been checked in display the beacons message to the user and check the user in
    notification.alertBody = beacon.Message!

        let newCheckIn = CheckIn(event: events, user: User.currentUser()!, beacon: beacon, time: NSDate(), numberOfCheckIns: beacon.Flokkers.count)
        newCheckIn.saveInBackground()
        beacon.checkIn(User.currentUser()!.objectId!)
    UIApplication.sharedApplication().presentLocalNotificationNow(notification)
    } else{

    }

}
func beaconManager(manager: AnyObject!, didExitRegion region: CLBeaconRegion!) {
    let notification = UILocalNotification()
    //tell the user goodbye once they leave the beacon region
    notification.alertBody = "Goodbye"
    print("bye")
    UIApplication.sharedApplication().presentLocalNotificationNow(notification)

}`
heypiotr commented 8 years ago

We'll be happy to help! Can you re-post this on our forums though?

https://forums.estimote.com

We want to keep GitHub issues for tracking bugs, or prospective bugs. Thanks for your understanding!