For years, signs of discord have brewed between Facebook and Apple.

Their chief executives, Tim Cook of Apple and Facebook's Mark Zuckerberg, have periodically taken thinly veiled shots at each other. "If they're making money mainly by collecting gobs of personal data, I think you have a right to be worried," Cook said of companies like Facebook in 2014. In turn, Zuckerberg has retorted: "You think because you're paying Apple that you're somehow in alignment with them? If you were in alignment with them, then they'd make their products a lot cheaper."

But now Apple is making changes that threaten Facebook's business — and the fight has intensified. Early next year, Apple plans to start requiring iPhone owners to choose whether to allow companies to track them across different apps, a practice that Facebook relies on to target ads and charge advertisers more.

On Wednesday, Facebook went on the offensive to forestall Apple's changes. The social network created a website that slammed Apple's moves as potentially hurtful to small businesses. (It did not mention that the changes could hurt itself.) To reinforce its displeasure, Facebook also took out full-page ads in the New York Times, the Wall Street Journal and the Financial Times to declare that it was "standing up to Apple."

And then to doubly emphasize its point, Facebook said it would provide information for an antitrust suit against Apple filed by Epic Games, the maker of Fortnite, so that the court would understand "the unfair policies that Apple imposes."

In a blog post, Dan Levy, a vice president for advertising at Facebook, said the company was taking the steps now because "we've heard from many of you, small businesses in particular, that you are concerned about how Apple's changes will impact your ability to effectively reach customers and grow — let alone survive in a pandemic." He added, "So we're speaking up for small businesses."

Apple executives have expected Facebook's protests and, in recent weeks, have vowed to go forward with the planned changes.

"It's already clear that some companies are going to do everything they can to stop the App Tracking Transparency feature," Craig Federighi, Apple's software chief, said in a speech recently. "We need the world to see those arguments for what they are: a brazen attempt to maintain the privacy-invasive status quo."

On Wednesday, in response to Facebook's public challenge, Apple said it was standing up for its users, who "should know when their data is being collected and shared across other apps and websites." The company added that Facebook did not need to stop tracking users or creating targeted advertising, but that "it simply requires they give users a choice."

The escalating tensions are part of an unusual high-stakes battle between two of the world's most valuable companies, which rely on each other and exert tremendous influence over digital behavior.

At the heart of the fight is how Facebook and Apple are diametrically opposed on how they make money — and which company wins out is likely to help shape the internet for years to come. Apple prefers that consumers pay for their internet experience, leaving less need for advertisers, while Facebook favors making the internet free, with the bill footed by companies that pay to show people ads.

The fracas is also a reminder of both companies' power over the internet, as well as their leverage over each other. Facebook needs its apps to work on Apple's devices to reach hundreds of millions of people. And Apple needs Facebook's apps — Facebook, Instagram, WhatsApp and Messenger — to make its devices worth their high price tags. That precarious relationship has underpinned their larger fight, with both careful not to do anything to blow it up.

"All of this is a long time coming," said Ben Bajarin, principal analyst at Creative Strategies in Silicon Valley. "A lot of the privacy moves that Apple has made over the past few years, in terms of allowing people to understand what's happening to them in the background, a lot of it has to do with Facebook."