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.
Try the system Console app with a search pic.twitter.com/tptYSypu5k
— Joe Pasqualetti (@jpasq03) September 17, 2017
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.
- Start by installing the app as on the phone simulator and open the watch simulator
- Open Console, select a device in the Sources list (left column) and then search for your process name.
- Build and run the watch app.
- Manually open the phone app within its simulator.
- 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
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.