I recently updated my Forerunner 955 to version 21.14 (beta) from version 20.xx. This upgraded the CIQ version from 5.0.1 to 5.0.2. Up until then, I was using a ConnectIQ watchface in which my font resources were loaded in the onLayout() call of the view, and then freed in the onHide() call.
After the update, swiping away from the watch face or in any way covering it causes the app to crash. The logs are fairly useless, as they don't have much more detail than just "unhandled exception". With the most recent SDK version in the sim, if I force onHide I can see that the error thrown is due to an onUpdate() call referencing a font AFTER onHide() has been called, after which point the font reference is set to null and the resource is freed, and so receives null rather than a valid reference. I don't think I can modify the sim to use an earlier SDK version, so I cannot say whether this behaviour was happening on prior CIQ version in the sim. I can say for certain that it was not happening on the device itself. But I don't understand why it was possible previously for this to work, unless either onLayout() was called every time the watch face was brought back into view, or the onHide() method was never called (and so the resources were never freed).
1. Was I doing something wrong previously with the way my font resources were loaded and freed?
2. Has something changed in CIQ that would cause this crash, perhaps an onUpdate() is being called out of turn?
3. What's the right was of loading and freeing resources? I have been looking at the docs and the sample watch face app from Garmin, and loading resources is suggested in a comment above both onLayout() AND onShow() - so which is right? I'm also aware that loadResource calls should be kept to a minimum, so it would seem that loading in onShow (which is called more frequently) would be worse for performance.
Thanks
PS. couldn't add a code block for some reason, but here is an example of what my (working) code looked like before the most recent update:
public class MyView extends Ui.WatchFace {
function initialize() {
Ui.WatchFace.initialize();
}
function onLayout(dc) {
clockFont = App.loadResource(Rez.Fonts.clock);
}
function onUpdate(dc) {
// draw stuff
}
function onPartialUpdate(dc) {
}
function onShow() {
}
function onHide() {
clockFont = null;
}
function onExitSleep() {
}
function onEnterSleep() {
}
}