Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Page Based "reloadRootControllersWithNames:" on launch loop?

- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
    [WKInterfaceController reloadRootControllersWithNames:@[@"pageOne", @"pageTwo"] contexts:nil];
}

Following Apple's guidelines

Call this method to reload the pages in your app’s page-based interface. At launch time, you use this method to customize the set of pages you want displayed.

at launch time, only results in a loop. With each reload calling awakeWithContext or will Activate or init again and again.

Is there a better way to go about reloading the Page-Based app on launch with a loop occurring?

like image 747
devone Avatar asked Mar 10 '15 00:03

devone


1 Answers

That is why awakeWithContext: exists. The first time your app is launched, the initial controller is passed nil as context. But if you reloadRootControllersWithNames:contexts:, you have an opportunity to pass a custom context instance and thus distinguish the launch mode.

like image 191
Aleks N. Avatar answered Oct 20 '22 23:10

Aleks N.