Swift 3, Xcode 8, XPC connection invalid issue

We migrated our application from objective c to Swift 3, using Estimote SDK, when we start monitoring, CoreBluetooth XPC connection invalid message appears and not discover anything. Did you have some ideas?

1 Like

Hi @acorsi!

Could you share more detailed issue description with us ? We would appreciate logs from invalid messages to provide you the best solution for that particular issue.

Hey @arek, in log we see this:

2016-10-12 10:09:32.558143 MyApp[1937:686827] [LogMessageLogging] 6.1
2016-10-12 10:09:32.602545 MyApp[1937:686826] [CoreBluetooth] XPC connection invalid

That’s all, we not have warning or exception only see this message when this line is called

beaconManager?.startMonitoring(for: beaconRegion!)

Thanks for your help!

Having the same problem when connecting to beacon. Any updates or solutions?

I think it was fixed in Xcode 8.1, this warning no longer shows in the console. In Xcode 8.0, you can safely ignore it.

@heypiotr I’m getting this error when trying to connect to a beacon. Using Xcode 8.1 and this issue only started with iOS10

Hey how are you all!, @gnazarkin I’m with you, with Xcode 8.1 and iOS 10 the issue continue, but we found a solution, our applications needs monitoring big areas with a lot of beacons, and with major and minor get info through a service, for this we need monitoring all the time, in an old implementation in objective c we are ranging all the time and works great, but with Swift 3 all fails.

We found when you start monitoring XPC Connection Invalid message appears in console and nothing happens, but we fixed changing our implementation and adding some properties to plist.

In plist add Privacy - Bluetooth Peripheral Usage Description, this property is not hard to approve by Apple, we send already some and all being approved. You just need to add a String say it why you use this.

Our class to manage beacons is like this:

func startMonitor()
    {
        let suuid = "YOUR BEACONS UUID"
        let beaconIdentifier = "YOUR BEACON IDENTIFIER"
        let uuid = UUID.init(uuidString: suuid)
        beaconRegion = CLBeaconRegion.init(proximityUUID: uuid!, identifier: beaconIdentifier)
        beaconRegion.notifyOnEntry = true
        beaconRegion.notifyOnExit = true
        beaconManager.startMonitoring(for: beaconRegion) //beaconManager is a global variable ESTBeaconManager type
    }

func beaconManager(_ manager: Any, didEnter region: CLBeaconRegion) {
   //You can send a local notification to know you enter in region
    beaconManager.startRangingBeacons(in: region)
}

func beaconManager(_ manager: Any, didExitRegion region: CLBeaconRegion) {
   //You can send a local notification to know you exit region
    beaconManager.stopRangingBeacons(in: region)
}

  func beaconManager(_ manager: Any, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {
   //Do whatever you want}

With this changes we make our applications work great even when app is in background or killed. Wish you luck!

Greetings

Ha, interesting. I know in iOS 10 using Core Bluetooth requires this Info.plist entry, otherwise the app gets rejected from the App Store. Fascinating to know it might also have something to do with detecting beacons via Core Location.

One more thing actually: @acorsi, @gnazarkin, do you have (had) those problems with our first-generation beacons (hardware version “D”) or the new generations? (hardware ver “G” and “F”)

HI Piotr. We have both kinds of beacons, the issue affects both kinds

@heypiotr I have version “D” beacons

I just have found out I was instantiating ESTBeaconManager like: self.estimoteManager = [[ESTBeaconManager alloc] init]; while in documentation is like self.estimoteManager = [ESTBeaconManager new]; this solved my issue with XPC Connection Invalid.

One of the reason of getting this error is , if object that we are using for bluetooth communication is going out of scope, i had created a class communicating with peripheral say BlueToothCommunication class and i have created its object in view did load of controller, but i made that object as local to view did load, making this object global solved my problem.