iOS app with three tabs:
- Data: live GPS position, accelerometer and compass, plus a scrollable log of
every location/heading callback iOS delivers (all fields) and synthesized NMEA
$GPGGA/$GPRMClines. - Map: a fully offline world map (no network, no tiles) with your position, accuracy circle, direction arrow and flown track.
- Trips: record flights and drives, keep every trip, see statistics, view each route on the map and export a travel logbook.
iOS does not expose raw GNSS data (no NMEA stream from the chip, no satellite
count / SNR, no pseudoranges — that exists only on Android). The lowest level you
can get is every CLLocation and CLHeading object CoreLocation emits, with every
field it carries. That is exactly what this app logs:
15:19:04.123 LOC #42 fix=2026-10-22T13:19:04.001Z age=0.12s lat=59.9139012 lon=10.7522345 hAcc=4.8m alt=11.9m ellAlt=51.2m vAcc=3.1m spd=0.00m/s spdAcc=0.52 crs=-1.0° crsAcc=-1.0 floor=- sim=0 acc=0
15:19:04.124 $GPGGA,131904.00,5954.8341,N,01045.1341,E,1,,,11.9,M,39.3,M,,*5C
15:19:04.124 $GPRMC,131904.00,A,5954.8341,N,01045.1341,E,0.00,,221026,,,A*6B
15:19:05.210 HDG mag=187.3° true=190.9° acc=15.0° field(uT) x=-12.3 y=21.7 z=-39.0
- Negative accuracy (
hAcc,vAcc,spdAcc,crsAcc) or-1course/speed means the field is invalid for that fix. altis height above mean sea level;ellAltis WGS-84 ellipsoid height.sim=1means the fix was simulated by software;acc=1means it came from an external accessory (e.g. a Bluetooth GPS).- The NMEA sentences are generated from the CLLocation values (satellite count and HDOP are left empty because iOS doesn't provide them). Turn them off with the NMEA button if you only want the raw lines.
This folder is a complete Xcode project. Nothing to configure except signing.
- Double-click
AeroGPS.xcodeproj. - In the Project navigator click the blue AeroGPS project icon → select
the AeroGPS target → Signing & Capabilities tab → set Team to
your Apple ID. (If the Team menu is empty: Xcode → Settings → Accounts → +,
sign in, then come back. A free Apple ID / "Personal Team" is enough.)
If Xcode complains the bundle identifier is taken, change
com.ogray.aerogpsto anything unique on the same tab. - Connect your iPhone by cable, unlock it, tap Trust.
- In the toolbar's device menu pick your iPhone (not a simulator) and press Run (⌘R).
- First time only, the phone asks for Developer Mode (Settings → Privacy & Security → Developer Mode → on, restart) and to trust the developer app (Settings → General → VPN & Device Management). Run again.
- In the app, allow location with Precise: On.
With a free Apple ID the installed app expires after 7 days; just run it from Xcode again.
The Simulator can fake a location (Features → Location) but has no accelerometer or compass, so use a real device.
Project facts: SwiftUI, Swift 5 language mode, deployment target iOS 16.0,
Info.plist is generated from build settings (the location permission string is
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription in the target's Build
Settings). The accelerometer via CMMotionManager needs no motion permission key.
- GPS keeps working in Airplane Mode — only the cellular/Wi-Fi/Bluetooth radios are switched off. Location Services stays on.
- Hold the phone against the window. The fuselage blocks most of the sky.
- Without a data connection there is no assistance data, so the first fix can take several minutes (cold start). Getting a fix on the ground before boarding helps.
- Expect
spdaround 220–260 m/s at cruise andaltaround 10–12 km.activityType = .airborneis set so CoreLocation does not discard those as implausible. - The compass (magnetometer) inside a metal fuselage will be unreliable; the
acc(accuracy) value shows how much to trust it.trueheading needs a GPS fix. - The accelerometer reports in g including gravity, so
|a|≈ 1.0 at rest and varies with turbulence. - The screen is kept awake while the app is in front. Use the share button (top-right of the controls row) to export the log as text.
The app has the Location updates background mode, so GPS, compass, the log and the track keep running when the screen locks or you switch apps. While it is in the background iOS shows a blue location pill in the status bar.
Without it, iOS suspends the app as soon as the screen locks: no fixes, no
compass, nothing is logged. When the app comes back, CoreLocation first hands
over old cached fixes (large age=) with locationUnknown errors, and the GPS
chip then needs time to find satellites again through the window.
Extra log lines that explain gaps:
APP active / resign active / background / will enter foregroundAPP screen locked / screen unlocked,low power mode=…,thermal state=…GAP no location callbacks for Ns— iOS sent nothing for that longWARN no fresh fix for Ns— callbacks may arrive, but only stale fixesAPP watchdog: restarted location updates— after 60 s with no fresh fix, then at most every 5 min, only while the app is on screen. In the background the watchdog only logs: with When-In-Use permission, stopping location updates there would end the app's background session and iOS would suspend it (this used to end recordings with the screen locked). On iOS 17+ the app also holds aCLBackgroundActivitySession.ERR code=0 locationUnknown— no fix right now; CoreLocation keeps trying
Persistent event log: every line except LOC, NMEA and HDG is also written to
Application Support/Logs/events.log (trimmed at 2 MB), plus a BEAT line every
60 s with app state, fix count, battery and thermal state. On launch the Data tab
shows the previous run's last events as PREV lines, so if the app was killed you
can see when, and in which state. Share it with the share menu → "Share event log".
iOS's own reasons for terminations (memory / CPU limit, crash, …) arrive later via
MetricKit and are logged as EXIT / CRASH / CPU lines.
Swiping the app away in the app switcher ends recording; iOS can also end a background app under heavy memory pressure. A recording trip resumes on next launch.
Running GPS continuously with the screen off uses battery; a 2-hour flight typically costs 10–20 %.
App Store note: in review notes, explain that background location is used to keep recording the flight track while the screen is locked.
The map is drawn from worldmap.bin (1.1 MB, bundled in the app), made from
Natural Earth 1:50m land, lakes, country
borders and ~1,250 cities. Natural Earth is public domain. It works anywhere,
including in Airplane Mode, because nothing is downloaded.
- Drag to pan, pinch or double-tap to zoom, the location button re-centres and follows you again.
- Blue dot = position (grey if the last fix is older than 10 s), faint circle = horizontal accuracy, arrow = GPS course when moving faster than 1 m/s, otherwise compass heading.
- Yellow line = flown track: fixes better than 150 m accuracy, one point per 10 m moved, up to 50,000 points. The trash button clears it.
- Lat/lon grid lines with labels, scale bar in km and nautical miles, and a top panel with position (degrees + decimal minutes), ground speed in knots and km/h, track, altitude in ft and m.
- 1:50m coastlines are accurate to roughly 1 km: good for following a flight, not for street-level navigation. Zoom beyond ~10 still works for the position and track, but the coastline will look coarse.
worldmap.bin format (little-endian; coordinates pre-projected to Web Mercator
unit space, x and y in 0...1): "WMAP", u32 version=1, u32 layerCount=6, then
layers land/land-coarse/lakes/lakes-coarse/borders/borders-coarse as
u32 shapes { u32 rings { u32 n, n × (f32 x, f32 y) } }, then
u32 cities { f32 x, f32 y, u8 scalerank, u8 len, UTF-8 name }.
Two trip types: Airplane and Car. The type can be changed later in the trip's details (all statistics are kept; only how they are shown changes).
- Start flight / Start drive start recording immediately; details can be added later. New trip with details… lets you pick the type and enter details first.
- Airplane: From / To are airports (IATA or ICAO code, or search by city), plus flight number, airline, aircraft, seat and notes. Speeds in kt, altitudes in ft.
- Car: the route is optional free text (drive wherever you like), plus vehicle and notes. No airport detection. Statistics: driving time (moving faster than 5 km/h), stopped time, distance, max and average speed, max / min altitude, total ascent / descent. Speeds in km/h, altitudes in m. The map marks the start and end of the track.
- The list can be filtered by type (All / Airplane / Car); totals follow the filter.
- Notes: while recording, the Note / Fueling / Food buttons add a note with the
current time and GPS position (the latest fix, or the last recorded point if the
fix is older than a minute). Notes can also be added to a finished trip (no
position) and edited or deleted at any time from the trip screen.
- Generic: any text.
- Fueling: fuel type, amount (litres, or kWh for Electric), total price and currency; price per litre is calculated.
- Food: what you ate, price and currency. Notes appear on the trip map (⛽ 🍴 📝), and the trip screen totals fuel and food costs (per currency). The last used currency and fuel type are remembered. Exports: GPX waypoints, a notes CSV (per trip and in the full export), and the text summary. The trip's own free text is now called "Comment".
- Airports are detected automatically: the departure is the airport nearest (within 10 km) to the start of the takeoff roll, the arrival the one nearest to the end of the landing roll. A code you typed is never replaced, except with Detect airports from track on the trip screen.
- "Airborne" means sustained ground speed above 35 m/s (68 kt). Flight time is from the first to the last moment at that speed. If recording started or stopped in the air, the value is marked partial.
- Statistics per trip: flight time, recorded time, distance flown, great-circle route distance, max and average ground speed, max altitude, max climb / descent rate, number of fixes and longest GPS gap. The list shows totals for all trips (air time, distance, airports and countries, highest, fastest, longest).
- Tap a trip to see its route on the offline map (recorded track in yellow, great-circle route dashed, departure green, arrival red), plus an altitude / speed profile. The map has a full-screen mode.
- Export: one trip as GPX, CSV (every fix) or a text summary; the share button in
the list exports the whole logbook as CSV (one row per trip, with a
typecolumn; flight-only columns are empty for drives) plus one GPX with all tracks. - Trips saved before trip types existed load as Airplane trips. Statistics are versioned: trips with statistics from an older version are recomputed from their saved track in the background on launch.
- Recording keeps at most one point per second (about 3 MB for a 10-hour flight), skips stale fixes, and writes to disk every 10 s. If the app is killed while recording, the trip continues recording after the next launch.
Storage: Application Support/Trips/<uuid>/trip.json (details + cached
statistics) and points.csv (t,lat,lon,alt,hAcc,vAcc,spd,spdAcc,crs per line).
Included in device backups.
Airports: airports.tsv (~7,950 airports with an IATA code, 630 KB) is built from
airportsdata (MIT). Columns: IATA,
ICAO, name, city, country, lat, lon, time zone. Takeoff and landing times are shown
in the airport's local time.
In SensorManager.init():
headingFilter = 3— degrees of change needed before a newHDGline. Set tokCLHeadingFilterNonefor every update (very chatty).maxLines = 4000— log ring-buffer size.accelerometerUpdateInterval = 1/10— accelerometer refresh rate for the card.