Forum Xamarin.iOS

WatchOS, where does the initial Interface controller's Awake context parameter context come from?

axaaxa Member ✭✭✭
edited November 2018 in Xamarin.iOS

So in a watchOS app, you will have an WKExtensionDelegate, and an initial WKInterfaceController run on start.
The WKInterfaceController will have its Awake method run, to which passes a 'context' parameter.

public partial class InitialInterfaceController : WKInterfaceController
    protected InitialInterfaceController(IntPtr handle) : base(handle)

    public override void Awake(NSObject context) // where does this come from?

Now I'm aware any subsequent WKInterfaceController can get a context from the previous WKInterfaceController such as calling

PresentController("SecondInterfaceController", "secondContext");

but I'm unsure how one might set data to the first or if it is even possible.

So is it possible, how?


Best Answer


  • axaaxa Member ✭✭✭

    I thought it might be possible to do something in the WKExtensionDelegate, which is apparently executed only once before the root controller, and then pass the result to the root controller...

    And this because i was having trouble executing code in the constructor of the root controller.

    Surely I'm doing something illegal in the constructor, but there is no report of error during debugging.
    if I can't figure it out ill post again later.

    thanks for chiming in.

Sign In or Register to comment.