In my viewDidLoad
method I call a method [self get_shcedule];
. This gets some values and stores in an array.
NSArray *filteredArray = [[jsonArray filteredArrayUsingPredicate:predicate] valueForKey:@"hour"];
In the same viewController I have an action define:
- (IBAction)update_schedule:(id)sender
which populates another array incase I wanted to update some of the values.
array2 = [[NSMutableArray alloc]init];
and array2
is sent to same backend server with updated values.
In theory it all works fine, except I am getting a weird bug.
- If I don't invoke the action, i.e., don't update the values and leave this particular page on my app. Upon return to this page everything works fine.
- If I update the values by calling the action and leave the page and visit another page on my app, upon return to this page I get my values incremented by one.
From my understanding the viewDidLoad
method is invoked every time a view is loaded if when we shift between pages on the same app.