Crash on Connection

Attempting to open a connection with the beacon (to later perform firmware checks and update values) is causing the app to crash.

The ESTCloudManager has had setupAppID called with our app credentials in the app’s root view.

The stack trace shows the following method calls just before terminating.

12 - [ESTBeaconVO objectForKey:inDictionary:]
13 - [ESTBeaconVO parseInitData:]
14 - [ESTBeaconVO initWithCloudData:]
15 - [ESTRequestBeaconDetails parseRespondedData:]
16 - [ESTRequestGetJSON connectionDidFinishLoading:]

Can you let me know the MAC address of the beacon you’re trying to connect to?

The one I’m currently using for testing:
edf5ef9d481f

Thanks! Forgot to ask about one more thing: can you let me know which version of the SDK you’re using? Can you try the latest one (3.2.7 at the time of this writing) and see if it also experiences this issue?

I downloaded the SDK from Github yesterday. I just double checked to make sure the files I was using were the 3.2.7 ones.

Just ran it again after and I get the same results.

@heypiotr
So I’m not sure where the problem is. The app here crashes when trying to simply check the beacon’s firmware (see opening post, it’s the same stack trace).

I’ve tested this with different beacons and it still crashes whether the beacon is running the A3.0.1 firmware or A2.2.0.

I have the same app written for Android and it has no problem (now) with checking beacon firmware. There’s other issues but those are on a separate topic.

I’ll try to reproduce this—is the problem happening when connecting (as you mentioned in the 1st post) or when updating firmware (the latest post)?

Is the stack trace you provided in the first post complete? Anything down the “ESTRequestGetJSON” thing? (I want to establish which exact method to test.)

Finally, I wonder if this could be an issue with corrupted cache. If you remove the app completely from your device and reinstall it, does the problem still occur?

The crash occurs when attempting to connect, invoking the “startConnection()” method. The error seems to happen after the response from the Estimote Cloud, as indicated by the stack trace of method calls right before crashing.
The delegate methods that would be called after the connection aren’t reached.

The stack trace provided is all the Estimote SDK calls in the stack. The rest is lower level calls outside even the Estimote SDK. Here’s the whole of the stack trace.

11 _CF_forwarding_prep_0
12 -[ESTBeaconVO objectForKey:inDictionary:]
13 -[ESTBeaconVO parseInitData:]
14 -[ESTBeaconVO initWithCloudData:]
15 -[ESTRequestBeaconDetails parseRespondedData:]
16 -[ESTRequestGetJSON connectionDidFinishLoading:]
17 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke
...
29 UIApplicationMain
30 main

I deleted the app and reran it. Same problem.

Weird, I can’t see any beacon details requests made to the Estimote Cloud in the past week for the “edf5ef9d481f” beacon. I mean, I can see some from the Estimote app, but nothing from any 3rd party apps, and that’d ordinarily include your app.

Any chance that e.g. you’re on a WiFi that requires you to accept terms of use before connecting, and your app is silently redirected to such page instead of successfully hitting the Estimote Cloud? That or maybe a firewall that’s blocking/corrupting the response?

Could you try making the beacon details request manually, in the terminal:

curl -u <APP_ID>:<APP_TOKEN> https://cloud.estimote.com/v1/beacons/edf5ef9d481f

I’m running the app on my home wifi, so there’s nothing to firewall it.
Not to mention that the same function works fine on the Android SDK (over the same wifi).
There’s other problems with the Android SDK but connecting to the Estimote Cloud isn’t one of them.

I tested out the manual request through the Terminal and got the full details of the beacon. I won’t copy the full details here but I got a JSON object with
id, uuid, major, minor, mac, and settings, with settings including a whole bunch of other details.

I have seen what errors I get if I attempt a Cloud request without initializing the app credentials, so I doubt that’s it.

Gotcha, thanks for checking.

Could you share the code snippet you use to initialize the BeaconConnection object and start the connection? Maybe that’ll nudge me in the right direction, towards what could be going wrong.

Good eye. I checked and found that I was initializing the ESTBeaconConnection object with an empty mac address. I’m honestly surprised it allowed me to do that in the first place.

That resolves that. Now I can move forward.

Ha, glad you caught that. And agreed, this definitely shouldn’t just crash the application, but throw a clear error message instead. We’ll address that, thanks!

Thanks for your help.
I have some issues on the Android SDK. The topics are created over on the Android forum.