The key reason Apple won their case is the fact that consumers generally purchase iPhones knowing ahead of time that their app download options are restricted to the App Store. If they disagreed with that restriction then they could have made the choice to purchase another phone instead, but deciding to purchase an iPhone anyway means they "knowingly agreed to the challenged restraint".
Under US law the precedent is very clear (established by the Supreme Court case Eastman Kodak v. Image Technical Services and the 9th Circuit case Newcal v. Ikon) that if the consumer knowingly agrees to aftermarket restraints ahead of time then that aftermarket will essentially not be considered a monopoly for antitrust purposes.
Source: The Epic v. Apple 9th Circuit ruling (specifically pages 30 to 40 which explains this in detail).