Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS App Wireless Profiling with Instruments: iPhone Always Offline

I'm working on an app that tracks the users location in background and sends the location to the backend from time to time. I'm interested in monitoring the impact on the battery over a daily use including:

  • User not moving
  • User walking from A to B
  • User driving from A to B

I think Instruments Energy Log and Location Energy Model would be ideal to track the device energy use and I would like to set a wireless tracking session of a few hours. I have setup a Profiling template and it correctly tracks the phone's data when plugged into my Mac, but I can't make it to turn on the wireless profiling mode!

My phone is constantly offline for Wireless Profiling. iPhone is online only if plugged. The wireless profile is always offline

Moreover I'm wondering if this the right way to go to keep my app 'under observation' for a few hours and then download the tracing data and analyze it at the end of the session.

iPhone model is a 5s. iOS Version is 10.3.2

Am I doing it right? Am I missing any steps to configure the wireless profiling (I followed the Apple Documentation about wireless profiling)

like image 412
Dobrocode Avatar asked Jun 17 '17 00:06

Dobrocode


2 Answers

There is a great option that Apple barely promotes - you can record untethered Energy and Networking data and then import it into Instruments later! On your test device go to the Developer pane in Settings. Logging should be the top option.

Instruments Logging in Developer settings pane

Toggle Energy or Network recording and then start recording.

Instruments recording options on device

Once you're done testing, stop the recording and connect to your development machine. Make sure to start a new Instruments session with the Energy or Networking template. The option to import from device will be grayed out if you don't have the matching instruments in the session.

Instruments import from device

You should be able to see variations in the GPS power state. I used this recently to catch a bug where the app was never releasing from high GPS utilization.

example Instruments data

iOS 11 & Xcode 9 beta 3 side note: I tested this whole process using the latest betas and of course it crashed Instruments during the import process.

like image 191
suite22 Avatar answered Nov 15 '22 07:11

suite22


I found a way to fix this issue without rebooting. In terminal, run /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/reenumerate_ios_devices. It worked instantly for me.

like image 35
Felix Lapalme Avatar answered Nov 15 '22 08:11

Felix Lapalme