Apple has confirmed that some of the source code for its iOS mobile operating system has been leaked online.
The boot-up source code used on its older iOS 9 operating platform was posted on code-sharing website Github.
Apple typically keeps most of its iOS source code private and ordered Github to remove the content.
But it said the leak had not necessarily compromised security.
In a statement, the company said the security of the iPhone did not rely on “the secrecy of its source code”.
It said it always encouraged customers to keep up to date with operating system upgrades.
The current operating system version is iOS 11
According to Apple, 93% of its users are using iOS 10 or above. These devices may no longer use the leaked code.
The leak of the code- called iBoot – was reported by news site Motherboard.
The code began with the statement: “This document is the property of Apple Inc. It is considered confidential and proprietary.”
Cyber-security expert Prof Alan Woodward, from the University of Surrey, said it was “extraordinary” that the code had been leaked.
“The source code for a company’s operating system is like the crown jewels – it is guarded very well,” he told the BBC.
Security researchers and hackers are likely to study the code, to see whether there are any flaws in it that might make unauthorised access possible, he added.
“If there’s nothing wrong with the code, it doesn’t matter that it’s out there,” he said.
“But Apple should be worried because if somebody has got hold of that, what else have they got? Assuming it is genuine, it has come from the inside somewhere.”
In a statement, Apple said: “Old source code from three years ago appears to have been leaked, but by design the security of our products doesn’t depend on the secrecy of our source code.
“There are many layers of hardware and software protections built into our products, and we always encourage customers to update to the newest software releases to benefit from the latest protections.”