hi i am trying to code an estimote application and i’ve started with the demo code but i am stuck here
let fetchLocationRequest = EILRequestFetchLocation(locationIdentifier: “my-kitchen”)
fetchLocationRequest.sendRequestWithCompletion { (location, error) in
if location != nil {
self.location = location!
} else {
print(“can’t fetch location: (error)”)
}
}
Xcode keeps telling me that ‘sendRequestWithCompletion’ has been renamed to ‘sendRequest Completion’. Can someone please explain this to me
here is a screenshot of my error and warnings
You’re on Xcode 8 beta, which ships with Swift 3, which changed the naming conventions. Our tutorials are for the latest stable version, i.e., Xcode 7 and Swift 2. So either switch to Xcode 7 for your Indoor development, or read up about the changes in Swift 3, and tweak the code—it should be fairly straightforward, e.g., for the error you’re getting, I think you just need to change
fetchLocationRequest.sendRequestWithCompletion { (location, error) in
to
fetchLocationRequest.sendRequest { (location, error) in
Thanks I fixed that but after implementing all the code and executing all i get is a white screen.
//
// ViewController.swift
// EstimoteTry2
//
// Created by Wei Rong on 19/7/16.
// Copyright © 2016 Wei Rong. All rights reserved.
//
import UIKit
class ViewController: UIViewController, EILIndoorLocationManagerDelegate {
@IBOutlet weak var locationView: EILIndoorLocationView!
let locationManager = EILIndoorLocationManager()
var location: EILLocation!
override func viewDidLoad() {
super.viewDidLoad()
self.locationManager.delegate = self
ESTConfig.setupAppID("<weirong10000-gmail-com-s-y-bim>", andAppToken: "<ccf15b4bf34d7e838ddee8b6eb837476")
let fetchLocationRequest = EILRequestFetchLocation(locationIdentifier: "weirong10000-s-location-cpz")
fetchLocationRequest.sendRequest { (location, error) in
if location != nil {
self.location = location!
self.locationManager.startPositionUpdates(for:self.location)
} else {
print("can't fetch location: \(error)")
}
}
}
func indoorLocationManager(manager: EILIndoorLocationManager!,
didFailToUpdatePositionWithError error: NSError!) {
print("failed to update position: \(error)")
}
func indoorLocationManager(manager: EILIndoorLocationManager!,
didUpdatePosition position: EILOrientedPoint!,
withAccuracy positionAccuracy: EILPositionAccuracy,
inLocation location: EILLocation!) {
var accuracy: String!
switch positionAccuracy {
case .veryHigh: accuracy = "+/- 1.00m"
case .high: accuracy = "+/- 1.62m"
case .medium: accuracy = "+/- 2.62m"
case .low: accuracy = "+/- 4.24m"
case .veryLow: accuracy = "+/- ? :-("
case .unknown: accuracy = "unknown"
}
print(String(format: "x: %5.2f, y: %5.2f, orientation: %3.0f, accuracy: %@",
position.x, position.y, position.orientation, accuracy))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
here is my code.
Hi Wei Rong,
Is there any way to post a video of the app running in your iPhone?
Thanks
Paulo
Do you get anything printed in the console? Error messages?
One idea:
ESTConfig.setupAppID("<weirong10000-gmail-com-s-y-bim>", andAppToken: "<ccf15b4bf34d7e838ddee8b6eb837476")
That should be:
ESTConfig.setupAppID("weirong10000-gmail-com-s-y-bim", andAppToken: "ccf15b4bf34d7e838ddee8b6eb837476")
I’m running it on the simulator and i get a blank screen
Nothing,It’s just a white screen
applied that, still no effect.
also i get this error from the simulator log
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Oh, simulator doesn’t support Bluetooth. You need to test on an actual device.
I did try on my iPhone 5S. I didnt get Error messages. Build Success! Should the app have ruined smoothly showing the proximity of the Beacons and changing/printing the images in the iPhone screen?
What should I do next?
Questions:
1- How could I import the 05 frameworks needed to run the Estimote SDK. Is there any video tutorial with step-by-step? May import this frameworks from any where?
I have watched the PhillyDev716 in youtube but I did get a lot of errors messages!!!
2- Where should I insert my Identifier and ID?
3- Is there any ready to customize app like the Estimote Beacon app. But with the easy as any WYSIWYG platform?
I am real newer with code and is my first time Xcode and first try developing.
Although I had already done some stuff with Estimote rev D. As well as with EddyStone link to HTTPS content.
The point now is that I need to run a proprietary app for Tourism and Retail/Hotels in a nice Balneario City to release before Christmas.
Thanks in advance,
Best regards, Paulo
I tried that, on Xcode 7 this time
//
// ViewController.swift
// ESTIMOTEIPHONE
//
// Created by Wei Rong on 25/7/16.
// Copyright © 2016 Wei Rong. All rights reserved.
//
import UIKit
class ViewController: UIViewController, EILIndoorLocationManagerDelegate {
@IBOutlet weak var myLocationView: UIView!
let locationManager = EILIndoorLocationManager()
var location: EILLocation!
override func viewDidLoad() {
super.viewDidLoad()
self.locationManager.delegate = self
ESTConfig.setupAppID("<weirong10000-gmail-com-s-y-bim>", andAppToken: "ccf15b4bf34d7e838ddee8b6eb837476")
let fetchLocationRequest = EILRequestFetchLocation(locationIdentifier: "my-kitchen")
fetchLocationRequest.sendRequestWithCompletion { (location, error) in
if location != nil {
self.location = location!
self.locationManager.startPositionUpdatesForLocation(self.location)
} else {
print("can't fetch location: \(error)")
}
}
}
func indoorLocationManager(manager: EILIndoorLocationManager!,
didFailToUpdatePositionWithError error: NSError!) {
print("failed to update position: \(error)")
}
func indoorLocationManager(manager: EILIndoorLocationManager!,
didUpdatePosition position: EILOrientedPoint!,
withAccuracy positionAccuracy: EILPositionAccuracy,
inLocation location: EILLocation!) {
var accuracy: String!
switch positionAccuracy {
case .VeryHigh: accuracy = "+/- 1.00m"
case .High: accuracy = "+/- 1.62m"
case .Medium: accuracy = "+/- 2.62m"
case .Low: accuracy = "+/- 4.24m"
case .VeryLow: accuracy = "+/- ? :-("
case .Unknown: accuracy = "unknown"
}
print(String(format: "x: %5.2f, y: %5.2f, orientation: %3.0f, accuracy: %@",
position.x, position.y, position.orientation, accuracy))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
all i get is a white screen.
Can someone please help? I can’t figure it out.
I can’t get the indoor location from the cloud i keep getting this error
can’t fetch location: Optional(Error Domain=ESTRequestBaseErrorDomain Code=403 “You have no access to the requested resource.” UserInfo={NSLocalizedRecoverySuggestion=Verify if requested resource belongs to you., NSLocalizedDescription=You have no access to the requested resource.})
i’ve tried the blank template and my own app. Is there any way to fix this?
i fixed the authentication error part, it was due to the < > symbols on my app id. But now i’m not getting any image, i think i’ve linked the viewer wrongly, can someone please check this code for me please?
//
// ViewController.swift
// ESTIMOTEIPHONE
//
// Created by Wei Rong on 25/7/16.
// Copyright © 2016 Wei Rong. All rights reserved.
//
import UIKit
class ViewController: UIViewController, EILIndoorLocationManagerDelegate {
@IBOutlet weak var myLabel: UILabel!
@IBOutlet weak var locationView: EILLocation!
let locationManager = EILIndoorLocationManager()
var location: EILLocation!
override func viewDidLoad() {
super.viewDidLoad()
myLabel.text = "hello world"
self.locationManager.delegate = self
ESTConfig.setupAppID("weirong10000-gmail-com-s-y-ahj", andAppToken: "ef2bb01e7d79dbf7f02cc4fa01af33f6")
let fetchLocationRequest = EILRequestFetchLocation(locationIdentifier: "weirong10000-s-location-cpz")
fetchLocationRequest.sendRequestWithCompletion { (location, error) in
if location != nil {
self.location = location!
self.locationManager.startPositionUpdatesForLocation(self.location)
} else {
print("can't fetch location: \(error)")
}
}
}
func indoorLocationManager(manager: EILIndoorLocationManager,
didFailToUpdatePositionWithError error: NSError) {
print("failed to update position: \(error)")
}
func indoorLocationManager(manager: EILIndoorLocationManager,
didUpdatePosition position: EILOrientedPoint,
withAccuracy positionAccuracy: EILPositionAccuracy,
inLocation location: EILLocation) {
var accuracy: String!
switch positionAccuracy {
case .VeryHigh: accuracy = "+/- 1.00m"
case .High: accuracy = "+/- 1.62m"
case .Medium: accuracy = "+/- 2.62m"
case .Low: accuracy = "+/- 4.24m"
case .VeryLow: accuracy = "+/- ? :-("
case .Unknown: accuracy = "unknown"
}
print(String(format: "x: %5.2f, y: %5.2f, orientation: %3.0f, accuracy: %@",
position.x, position.y, position.orientation, accuracy))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
If you want to draw a map, then I’d recommend to check out this ready-made example: