Closed JoeyBodnar closed 5 years ago
Hi Joey, did you try running the sample app on your phone?
not yet, will try soon
Hi @JoeyBodnar, The SDK doesn't rely on Push Notifications. Have you enabled the Uses Bluetooth LE accessories in the app capabilities?
alright I have the sample project. I ran pod install on it but it won't compile, but I still was able to get some code from it to use as an example. However, the beacons are still not being detected. Yes, I have enabled Uses Bluetooth LE in the app capabilities. Here is my current code:
//info.plist
<key>co.nearbee.api_key</key>
<string>xxxxxx</string>
<key>co.nearbee.organization_id</key>
<string>Our Organization</string>
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
</array>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>We use bluetooth to find restuarants in your area</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We need to know your location to find restaurants in your area</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>We need to know your location to find restaurants in your area</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need to know your location to find restaurants in your area</string>
// App Delegate, didFinishLaunchingWithOptions
let localCatergory = UNNotificationCategory(identifier: "nearbyNotificationView", actions: [], intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([localCatergory])
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
(granted, error) in
}
For the view controller code, I have updated the gist here, as it's a bit longer: https://gist.github.com/JoeyBodnar/ac2344b10bdc07627cbf641e862db4d6
Also, I have noticed that if I force-unwrap the nearBee variable, it crashes because it is nil--even after instantiating it. For example this code:
override func viewDidLoad() {
super.viewDidLoad()
print(nearBee)
nearBee = NearBee.initNearBee()
print(nearBee)
nearBee!.delegate = self
nearBee!.enableBackgroundNotification(true)
}
will crash at nearBee!.delegate = self, and print(nearBee) prints nil both times, like it is not correctly instantiating it.
ok I got the sample app to compile--under "Linked frameworks and Libraries, I needed to make Pods_SampleApp.framework optional, not required--for any future visitors)
The sample app also crashed on line 33 of ViewController.swift, this line:
nearBee.delegate = self
Device: iPhone X iOS: 12.1.2 Bluetooth is turned on for my device as well.
@JoeyBodnar, Are you a customer of Beaconstac? Can you share the email id associated with your Beaconstac account?
@sachinmobstac @JoeyBodnar is working with me on this app. I'd prefer not to post the full email address publicly here. The front part of the email before the @ symbol is amace. If you need the full address, @ravipratapm has been communicating with me. He should be able to provide the account. Ryan
@rv888, I have sent you an email. I hope it clarifies on how to configure the SDK.
What else do I need to do iOS-side?
I have sent an email to your registered email with the Beaconstac on how to configure the SDK, the NearBee will be nil if the values of co.nearbee.api_key
and co.nearbee.organization_id
is wrong. @rv888, please forward the email to @JoeyBodnar.
alright cool, thanks! we will try to get it sorted out soon.
Alright, the organization_id was incorrect. The issue is resolved and it can be closed. Thanks for your help!
I am wondering exactly how the push notifications work for iOS. The readme doesn't mention anything about it. The notifications are being sent from Beaconstac, correct? It isn't something we need from our server, right?
Right now I have the app setup to use bluetooth and get the user's current location, but it is not finding any beacons. Here is a simple gist of what my current ViewController code is: https://gist.github.com/JoeyBodnar/ac2344b10bdc07627cbf641e862db4d6
However, I never receive any notifications, nor do any of the delegate callbacks (onBeaconsFound, onBeaconsUpdated, etc) fire inside the app. Is there something I am missing?
also, the line: let nearBeeInstance = try! NearBee.sharedInstance()
from the readme does not compile. It says "type NearBee has no member 'sharedInstance'.
thank you