Hi,
I am building an IOS app using Estimote Indoor SDK, and I got an Error from server when I finished building my location using locationBuilder and uploaded to Estimote cloud using addLocationRequest.sendRequest() method. The error message is as the following:
2017-05-11 17:29:36.655 EyesOnUCSD[70223:10710832] Error when saving location: Optional(Error Domain=ESTRequestBaseErrorDomain Code=400 “The server cannot or will not process the request due to an apparent client error.” UserInfo={NSLocalizedDescription=The server cannot or will not process the request due to an apparent client error., NSLocalizedRecoverySuggestion=Verify provided URL and params.})
I have verified my appId and appToken, they are both valid. Actually they work pretty well when I fetch location from the server.(I have some locations stored on Estimote Cloud already, but they were created using the Estimote Indoor App, I am trying the locationBuilder approach).
I have been stuck on this for hours and could not figure out why. I will paste my code down there. I would really appreciate any help. Thank you!
class LocationCreationHelper: NSObject {
static func MapNewLocation() {
let locationBuilder = EILLocationBuilder()
locationBuilder.setLocationName("Design Lab 3")
locationBuilder.setLocationBoundaryPoints([
EILPoint(x: 0.00, y: 0.00),
EILPoint(x: 0.00, y: 6.81),
EILPoint(x: 12.57, y: 6.81),
EILPoint(x: 13.84, y: 0.00)])
locationBuilder.addBeacon(withIdentifier: BeaconConstants.A_Identifier,
atBoundarySegmentIndex: 0, inDistance: 2.36, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.B_Identifier,
atBoundarySegmentIndex: 0, inDistance: 4.14, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.C_Identifier,
atBoundarySegmentIndex: 1, inDistance: 3.32, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.D_Identifier,
atBoundarySegmentIndex: 1, inDistance: 6.85, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.E_Identifier,
atBoundarySegmentIndex: 1, inDistance: 1.9, from: .rightSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.F_Identifier,
atBoundarySegmentIndex: 2, inDistance: 2.29, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.G_Identifier,
atBoundarySegmentIndex: 3, inDistance: 1.29, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.H_Identifier,
atBoundarySegmentIndex: 3, inDistance: 5.02, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.I_Identifier,
atBoundarySegmentIndex: 3, inDistance: 8.65, from: .leftSide)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.J_Identifier,
atBoundarySegmentIndex: 3, inDistance: 2.38, from: .rightSide)
let k_position = EILOrientedPoint.init(x: 8.8, y: 2.79)
locationBuilder.addBeacon(withIdentifier: BeaconConstants.K_Identifier, withPosition: k_position)
locationBuilder.setLocationOrientation(300)
if let location = locationBuilder.build() {
ESTConfig.setupAppID(AppConstants.AppId, andAppToken: AppConstants.AppToken)
let addLocationRequest = EILRequestAddLocation(location: location)
addLocationRequest.sendRequest { (location, error) in
if error != nil {
NSLog("Error when saving location: \(String(describing: error))")
} else {
NSLog("Location saved successfully: \(String(describing: location?.identifier))")
}
}
} else {
NSLog("location is null")
}
}
}