Push notifications on part 2 of tutorial

I’m on part 2 of the tutorial (background monitoring) and am unable to get it to send me a push notification. I enabled flip to sleep mode and am running a simulator in XCode. I’ve read online I may need to enable the accelerometer - my menu when I click on “Beacon Motion” is only another link to the “Flip to Sleep” toggle. Any ideas on what I might be doing wrong? I followed the tutorial step by step, and don’t want to proceed further in the development process without ensuring the beacons are working.

Hi @tdoyle,

can you post the code of your app’?
Maybe someone would be able to solve the problem.

Here is my code:

import CoreData
import UserNotifications

class AppDelegate: UIResponder, UIApplicationDelegate, ESTBeaconManagerDelegate, UNUserNotificationCenterDelegate  {
    var window: UIWindow?
    // 2. Add a property to hold the beacon manager and instantiate it
    let beaconManager = ESTBeaconManager()
//    let center = UNUserNotificationCenter.current()
//    let options: UNAuthorizationOptions = [.alert, .sound];
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // 3. Set the beacon manager's delegate
    self.beaconManager.delegate = self
    self.beaconManager.startMonitoring(for: CLBeaconRegion(
        proximityUUID: UUID(uuidString: "B9407F30-F5F8-466E-AFF9-25556B57FE6D")!,
        major: 45202, minor: 19888, identifier: "monitored region"))
        return true;
    func beaconManager(_ manager: Any, didEnter region: CLBeaconRegion) {
        let content = UNMutableNotificationContent()
        content.body =
            "Your gate closes in 47 minutes. " +
            "Current security wait time is 15 minutes, " +
            "and it's a 5 minute walk from security to the gate. " +
        "Looks like you've got plenty of time!"
        let trigger = didEnter region
        let request = UNNotificationRequest(
            trigger: trigger)

The older beacons required you to manually enable accelerometer if you wanted to enable Flip to Sleep. Our modern beacons automatically enable/disable the accelerometer if you enable any features that require it. (Flip to Sleep, Motion Only, Shake to Connect, etc.)

The problem here is that Xcode Simulator does not support Bluetooth. You could implement the “monitoringDidFail” delegate method, and see that it’ll get called with an appropriate error object/message.