MVC pattern on watchOS

Hey guys,


ATM I'm porting my iOS app to watchOS; in order to fetch JSON data the watch app uses the model of its parent app. When the model finished downloading the data, it notifies the delegate that the data is ready to be passed back. The delegate (view controller) implements the delegate method (which will get called when the items are finished downloading) via a protocol. Anyway, in my watch app I've a button which triggers the model to fetch the data:

- (IBAction)chosenRefresh {
    [_homeModel downloadItemsWithQuery:[[NSUserDefaults standardUserDefaults] objectForKey:@"grade"]];
}

Bizarrely the model's downloadItemsWithQuery: method just won't get called when the button is pressed and I absolutely don't have a clue why this is the case! I have already debugged this part of the code; when I set the breakpoint in the line where downloadItemsWithQuery: should get called, the debugger doesn't jump in the model's class (containing the implementation of downloadItemsWithQuery:). Does anyone of you have an idea why the method just won't get called? It's as if the chosenRefresh method were empty ... Of course chosenRefresh is getting called when the button is pressed ... By the way, I fetch the data via NSURLSession, which should be supported by watchOS 2. Would be so cool if anyone of you had a clue!! 🙂 Thank you so much for your help!!!


Kind regards,


Alex

Accepted Answer

Could _homeModel be nil?

MVC pattern on watchOS
 
 
Q