I mean the rest of it. I went to bed believing that I was more or less in control — that the unfinished business, unrealized dreams and other disappointments in my life were essentially failures of industry and imagination, and could probably be redeemed with a fierce enough effort. I woke up to the realization of how ludicrous that was.

— Am I Going Blind?, by Frank Bruni, Feb. 23, 2018.

Where were you in the 38 minutes of terror?

I’ve been traveling for work reasons and that means I am away from family. When the 38 minutes of terror happened on January 13th, 2018 I was at an AirBNB home. The sky was bright blue and everything was glistening with white snow that had fallen overnight; swinging us from 60ºF to 17º that afternoon. I was catching up on tasks and chores for the day. In another window I was checking Twitter. A lazy Saturday.

Then I saw the first tweet. I don’t remember exactly what it was but it’s likely that @SwiftOnSecurity retweeted an individual with a screenshot of the emergency alert notification followed by more individuals with the same warning.

“Emergency Alert BALLISTIC MISSILE THREAT INBOUND TO HAWAII. SEEK IMMEDIATE SHELTER. THIS IS NOT A DRILL.”

Could it be a prank or could this be the nuclear annihilation that brings holocaust to Earth? The opening and closing salvo in mutually assured destruction.

On the second or third tweet I knew this needed my full attention. I raced to find a national news outlet online. In a single second that felt like thirty seconds my mind picked cnn.com and I found… nothing. Just the vapidity of the 24 hour news cycle. The livestream didn’t work so then I turned to foxnews.com and found nothing there either. I tried CNN on my phone hoping that I could get the livestream. With “Download now” buttons I was directed to the App Store and started downloading it. I checked msnbc.com and found nothing there either. How could this go unnoticed? What good is nonstop news and Eastern Time if they can’t warn us?

I could feel my heart beating through my entire chest. I was losing time and all I had was scraps of Twitter that couldn’t make the puzzle whole. There were so many questions. I was starting to shake and had to do something.

I stood up and walked downstairs to find the AirBNB host. Her boyfriend was out shoveling, she was on the first floor. She helped me turn on the television and find a news station. We watched vapid commercials about buying gold and geriatric medicine in confusion for a brief time.

The house had bilingual instructions for guests. The fridge had ethnic foods and the room had ethnic restaurant menus. This family that I stayed with by way of an app on our phones certainly had family and friends somewhere in Asia. Or at the very least travelers that stayed with them, that they hosted and gave food and shelter to who could be just as close to danger as us. I had to let her know.

“I… I don’t mean to frighten you but you should see this. … I hope it’s a false alarm, it could be a false alarm.”

She looked at the screenshot of the emergency alert and was unphased. Her upbeat demeanor didn’t flinch. The time was 16 minutes after the hour.

“The tweets are from 7-8 minutes ago so hopefully nothing’s happening.”

She shrugged it off like a likely hoax with optimism, left some solace and called out to her boyfriend about their plans for their normal Saturday in an American city.

More tweets and still nothing on the television. My body felt that I needed to bolt out the door to keep air flowing into my lungs and also like I could collapse into the couch if a breeze grazed me.

We weren’t yet obliterated. My mind was racing.

When was the last time I spoke with my grandparents? When did I last see them? I’ve been traveling since January. What was the last thing I said to my family and to my girlfriend? How do they remember me and where are they right now? What was the last thing they had thought about me? How do I account for everyone I love; how could I in just a few minutes if there was no more time? Who could I reach by phone and speak to if we knew we had a chance to speak before the end? What would I even say?

I was overwhelmed and didn’t have any useful information. My host didn’t seem to mind. Outside there were people shoveling and living their lives.

I went back upstairs and collapsed into the chair and saw all of the tweets that I could.

By 1:25pm I saw the relief “NO missile threat to Hawaii.” from the Hawaii EMA account. Later that day I texted my girlfriend “It’s only 7:46pm but tonight it feels like 11 PM.” As I sat at that desk and tried to calm down, I knew that I had experienced a new level of fear.

End of Workout Week

With other projects occupying my time I’ve removed Workout Week from the App Store. I was able to use that project to advance my knowledge and to work with Apple Watch connectivity which I’m glad for. I don’t anticipate making enough improvements to continue it and delisting the app frees up my attention and focus. Thank you all for your consideration and trying my little app.

Debugging Apple Watch Connectivity with Console


In debugging Apple Watch apps and their communication with the parent iOS app I have needed to access the logs of both simulated devices in the same debugging session.

Xcode 8 will run one debugging session and the Watch simulator will launch the iOS Simulator to communicate its iOS app which precludes using the iOS Simulator for debugging and logs. In the other direction the iOS Simulator will kill and then install the watch app at the start of its build and run (observe this from the Watch’s home screen). Building and running either app prevents running both at the same time. Without having tried the GM, (I know, I know) Xcode 9 should be an improvement on this in automated and manual testing.

Running two debug sessions on physical devices runs into the same problem of the iOS app re-installing the watch app when running from Xcode. To work around this the Console application (truly Console.app) will allow you to observe and capture logs from a given process or even device.

  1. Start by installing the app as on the phone simulator and open the watch simulator
  2. Open Console, select a device in the Sources list (left column) and then search for your process name.
  3. Build and run the watch app.
  4. Manually open the phone app within its simulator.
  5. Ta-da, observe the phone logs in Console and the watch logs in Xcode (or Console).

For Swift developers you may need to start using NSLog again as only NSLog is directed to the Apple System Log (man 3 asl and man syslog). Swift’s print is great but not as helpful here.

 

NSCompoundPredicate

While working on a side project for fun I had a need to query the Health app and retrieve workout samples from a given date range and of a given type.

The HealthKit APIs accept NSPredicate objects or you can use convenience functions that accept workout types or dates. To use both a date range and a workout type one should construct your own predicates and combine them with NSCompoundPredicate. This code gist (embedded below) shows a very simple use case for Swift 3.0.