import UIKit
class ViewController: UIViewController, EILIndoorLocationManagerDelegate {
@IBOutlet weak var myLocationView: EILIndoorLocationView!
var locationManager = EILIndoorLocationManager()
var location: EILLocation!
override func viewDidLoad() {
super.viewDidLoad()
self.locationManager.delegate = self
let locationBuilder = EILLocationBuilder()
locationBuilder.setLocationName("office")
locationBuilder.setLocationBoundaryPoints([
EILPoint(x: 0.00, y: 0.00),
EILPoint(x: 0.00, y: 4.00),
EILPoint(x: 4.48, y: 4.00),
EILPoint(x: 4.48, y: 0.00)])
locationBuilder.addBeacon(withIdentifier: "395b8767bd63efc0fff23894fa05cb0b",
atBoundarySegmentIndex: 0, inDistance: 4.46, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: "4bb0675d47649d4273a9bb963ea9dd13",
atBoundarySegmentIndex: 1, inDistance: 0.38, from: .rightSide)
locationBuilder.addBeacon(withIdentifier: "739cd8034732d5349f15c33c625c9f05",
atBoundarySegmentIndex: 2, inDistance: 4.46, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: "a823daa6f67076543143752b57514507",
atBoundarySegmentIndex: 3, inDistance: 0.43, from: .rightSide)
locationBuilder.setLocationOrientation(270)
guard let location = locationBuilder.build()else {
print ("Error whe building location")
return
}
ESTConfig.setupAppID("<configuration-3rj>", andAppToken: "<668f7c994b82b07e902ccf4a3d7d88ba")
let addLocationRequest = EILRequestAddLocation(location: location)
addLocationRequest.sendRequest { (location, error) in
if error != nil {
NSLog("Error when saving location")
} else {
NSLog("Location saved successfully")
}
}
}
override func viewWillAppear(_ animated: Bool){
myLocationView.backgroundColor = UIColor.clear
myLocationView.showTrace = true
myLocationView.showWallLengthLabels = true
myLocationView.rotateOnPositionUpdate = false
myLocationView.locationBorderColor = UIColor.black
myLocationView.locationBorderThickness = 6
myLocationView.doorColor = UIColor.brown
myLocationView.doorThickness = 5
myLocationView.traceColor = UIColor.yellow
myLocationView.traceThickness = 2
myLocationView.wallLengthLabelsColor = UIColor.black
myLocationView.drawLocation(location)
locationManager.state(for: location)
}
override func viewWillDisappear(_ animated: Bool){
super.viewWillDisappear(animated)
locationManager.stop()
}
func indoorLocationManager(_ manager: EILIndoorLocationManager, didFailToUpdatePositionWithError error: NSError!){
NSLog("Did fail to update location")
}
}
// i repaired error: nstance method 'indoorLocationManager(_:didFailToUpdatePositionWithError:)' nearly matches optional requirement 'indoorLocationManager(_:didFailToUpdatePositionWithError:)' of protocol 'EILIndoorLocationManagerDelegate'
Candidate has non-matching type '(EILIndoorLocationManager, NSError?) -> ()'//
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
```
It's my code. I made view panel. But i have error, and my app doesn't work. I don't know what's wrong... I have no connection beetwen myLocationView and my View? What should i do?
**configuration[2440:65842] [CoreBluetooth] XPC connection invalid**
application UIApplication 0x00007fe68f503af0
UIKit.UIResponder UIResponder
baseNSObject@0 NSObject
launchOptions [UIApplication.LaunchOptionsKey : Any]? nil none
self configuration.AppDelegate 0x0000600000ba3100
UIKit.UIResponder UIResponder
window UIWindow? 0x00007fe68f4136d0