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
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.”
thanks you RSS link