SAN FRANCISCO — Apple’s new ResearchKit software platform turns the iPhone into a diagnostic tool drawing medical data from millions of potential customers, creating a boon for researchers and a headache for privacy advocates.

With iPhone users’ permission, Apple will be able to take data gleaned from its Health app and share it with doctors and scientists to use in medical research, said Chief Executive Officer Tim Cook at an Apple event Monday in San Francisco. The information could include a user’s weight, blood pressure and activity levels, as well as information on conditions such as diabetes, cardiovascular disease, asthma and breast cancer.

Apple’s apps “already help millions of customers track and improve their health,” said Jeff Williams, Apple’s senior vice president of operations, in a statement. “With hundreds of millions of iPhones in use around the world, we saw an opportunity for Apple to have an even greater impact by empowering people to participate in and contribute to medical research.”

ResearchKit joins health-tracking technology tools such as Fitbit Inc.’s wristwear that can generate reams of data on people’s health and activity levels. While researchers are enthusiastic about having access to such information culled from a diverse population, privacy advocates are concerned the information could be tied to individual users.

As the iPhone’s technology has advanced, the data it can capture on its customers’ activity has gone far beyond the basics, like the number of steps a user has taken in a day. Researchers will be able to ask for access to the accelerometer, microphone, gyroscope and GPS sensors in the iPhone “to gain insight into a patient’s gait, motor impairment, fitness, speech and memory,” Apple said in its statement.

Using separate devices made by other companies, the iPhone can also gather information such as glucose levels and asthma inhaler use.

Many consumers don’t understand that the health data they share with an app or device may be used in ways they hadn’t intended, like to market to them or profile them online, said Jennifer Geetter, a health lawyer and partner at McDermott Will & Emery LLP.

Data shared with an app or wearable device aren’t typically protected by federal medical privacy laws the way information shared with a doctor is. They can be sold, shared and stored in various ways depending on a company’s privacy policy.

There is also the risk that data could fall into the hands of hackers. Health-care data breaches are on the rise because health information can fetch 10 times the price of financial data on the black market, security analysts have said.

Consumers should question any medical advice that comes from the apps, because it isn’t likely to be peer-reviewed, said Adrian Gropper, chief technology officer of Patient Privacy Rights, a nonprofit group.

Apple did take a step to ensure the safety of patient data by making ResearchKit open-source, which means that the code used to write the software is visible by the public, Gropper said.