When I try to use ViewLoop together with ViewLoopDelegate as an initial View of app, the app crashes with following error
Error: Unexpected Type Error
Details: Failed to start CIQ Application
Stack:
Encountered app crash.
The code I am trying to run is following
import Toybox.Application;
import Toybox.Lang;
import Toybox.WatchUi;
import Toybox.Graphics;
class testApp extends Application.AppBase {
function initialize() {
AppBase.initialize();
}
function onStart(state as Dictionary?) as Void {
}
function onStop(state as Dictionary?) as Void {
}
function getInitialView() as Array<Views or InputDelegates>? {
var loop = new WatchUi.ViewLoop(new Factory(), {:wrap => true});
return [ loop, new WatchUi.ViewLoopDelegate(loop)] as Array<Views or InputDelegates>;
}
}
class TestView extends WatchUi.View {
function initialize() {
View.initialize();
}
function onLayout(dc as Dc) as Void {
setLayout(Rez.Layouts.MainLayout(dc));
}
function onShow() as Void {
}
function onUpdate(dc as Dc) as Void {
View.onUpdate(dc);
}
function onHide() as Void {
}
}
class Factory extends WatchUi.ViewLoopFactory{
function initialize(){
ViewLoopFactory.initialize();
}
public function getSize(){
return 3;
}
public function getView(page as Lang.Number){
var view = new TestView();
return [view, new WatchUi.BehaviorDelegate()];
}
}
function getApp() as testApp {
return Application.getApp() as testApp;
}
When I Add some DummyView to my app, that imediately switches the active view to ViewLoop in onLayout using WatchUi.SwitchToView, everything works ok.