Apple's Tim Cook was 'deeply offended' by a BBC report into conditions in the firm's iPhone 6 production line at the Pegatron factories near Shanghai.

Panorama secretly filmed on an iPhone 6 production line and found workers falling asleep on their 12 hour shifts.

It also claimed that Apple's standards on ID cards, dormitories, work meetings and juvenile workers were being breached at the Pegatron factories.

Scroll down to read the full letter

As part of the undercover BBC investigation, exhausted workers were filmed falling asleep on their 12 hour shifts in two factories run by Pegatron on the outskirts of Shanghai on the iPhone 6 (pictured) production line.

PANORAMA CLAIMS Panorama claims workers falling asleep on their 12 hour shifts. As well as excessive hours, it claimed that Apple's standards on ID cards, dormitories, work meetings and juvenile workers were being breached at the Pegatron factories. Reporter Richard Bilton found children digging tin ore out by hand in extremely dangerous conditions. Advertisement

In an email to its 5,000 UK staff at 8am this morning seen by MailOnline, Apple's Senior Vice-President of Operations, Jeff Williams, addressed the issues.

He said Cook was 'deeply offended by the suggestion that Apple would break a promise to the workers in our supply chain' or mislead customers.

'I'd like to give you facts and perspective, all of which we shared with the BBC in advance, but were clearly missing from their program,' he said.

'Panorama's report implied that Apple isn't improving working conditions.

'Let me tell you, nothing could be further from the truth.'

Meanwhile, Apple supplier Pegatron said it was looking into Panorama's findings.

'Worker safety and well-being are our top priorities. We set very high standards, conduct rigorous training for managers and workers, and have external auditors regularly visiting our facilities to find areas for improvement,' it said.

Experts have defended Apple, claiming the BBC's report does not fairly reflect conditions in China.

'I think Apple is doing as much, if not more than any other major electronics company,' Dan Viederman of Verite, which works with governments and major firms to improve working conditions and eliminate human rights violations, told Daily Mail Online.

As part of the undercover BBC investigation, exhausted workers were filmed falling asleep on their 12 hour shifts in two factories run by Pegatron on the outskirts of Shanghai.

APPLE'S LETTER IN FULL UK Team, As you know, Apple is dedicated to the advancement of human rights and equality around the world. We are honest about the challenges we face and we work hard to make sure that people who make our products are treated with the dignity and respect they deserve. Last night, the BBC's Panorama program called those values into question. Like many of you, Tim and I were deeply offended by the suggestion that Apple would break a promise to the workers in our supply chain or mislead our customers in any way. I'd like to give you facts and perspective, all of which we shared with the BBC in advance, but were clearly missing from their program. Panorama showed some of the shocking conditions around tin mining in Indonesia. Apple has publicly stated that tin from Indonesia ends up in our products, and some of that tin likely comes from illegal mines. Here are the facts: Tens of thousands of artisanal miners are selling tin through many middlemen to the smelters who supply to component suppliers who sell to the world. The government is not addressing the issue, and there is widespread corruption in the undeveloped supply chain. Our team visited the same parts of Indonesia visited by the BBC, and of course we are appalled by what's going on there. Apple has two choices: We could make sure all of our suppliers buy tin from smelters outside of Indonesia, which would probably be the easiest thing for us to do and would certainly shield us from criticism. But it would be the lazy and cowardly path, because it would do nothing to improve the situation for Indonesian workers or the environment since Apple consumes a tiny fraction of the tin mined there. We chose the second path, which is to stay engaged and try to drive a collective solution. We spearheaded the creation of an Indonesian Tin Working Group with other technology companies. Apple is pushing to find and implement a system that holds smelters accountable so we can influence artisanal mining in Indonesia. It could be an approach such as 'bagging and tagging' legally mined material, which has been successful over time in the Democratic Republic of the Congo. We are looking to drive similar results in Indonesia, which is the right thing to do. Panorama also made claims about our commitment to working conditions in our factories. We know of no other company doing as much as Apple does to ensure fair and safe working conditions, to discover and investigate problems, to fix and follow through when issues arise, and to provide transparency into the operations of our suppliers. I want you to know that more than 1400 of your Apple coworkers are stationed in China to manage our manufacturing operations. They are in the factories constantly — talented engineers and managers who are also compassionate people, trained to speak up when they see safety risks or mistreatment. We also have a team of experts dedicated solely to driving compliance with our across our vast supply chain. In 2014 alone, our Supplier Responsibility team completed 630 comprehensive, in-person audits deep into our supply chain. These audits include face-to-face interviews with workers, away from their managers, in their native language. Sometimes critics point to the discovery of problems as evidence that the process isn't working. The reality is that we find violations in every audit we have ever performed, no matter how sophisticated the company we're auditing. We find problems, we drive improvement, and then we raise the bar. Panorama's report implied that Apple isn't improving working conditions. Let me tell you, nothing could be further from the truth. Here are just a few examples: Several years ago, the vast majority of workers in our supply chain worked in excess of 60 hours, and 70+ hour workweeks were typical. After years of slow progress and industry excuses, Apple decided to attack the problem by tracking the weekly hours of over one million workers, driving corrective actions with our suppliers and publishing the results on our website monthly — something no other company had ever done. It takes substantial effort, and we have to weed out false reporting, but it's working. This year, our suppliers have achieved an average of 93% compliance with our 60-hour limit. We can still do better. And we will. Our auditors were the first to identify and crack down on a ring of unscrupulous labor brokers who were holding workers' passports and forcing them to pay exorbitant fees. To date, we have helped workers recoup $20 million in excessive payments like these. We've gone far beyond auditing and corrective actions by creating educational programs for workers in the same facilities where they make our products. More than 750,000 people have taken advantage of these college-level courses and enrichment programs, and the feedback we get from students is inspiring. I will not dive into every issue raised by Panorama in this note, but you can rest assured that we take all allegations seriously, and we investigate every claim. We know there are a lot of issues out there, and our work is never done. We will not rest until every person in our supply chain is treated with the respect and dignity they deserve. If you'd like to learn more about our Supplier Responsibility program, I encourage you and our customers to visit our website. Thanks for your time and your support. Jeff Advertisement

One undercover reporter, working in a factory making parts for Apple computers, had to work 18 days in a row despite repeated requests for a day off.

Another reporter, whose longest shift was 16 hours, told the programme: 'Every time I got back to the dormitories, I wouldn't want to move.

'Even if I was hungry I wouldn't want to get up to eat. I just wanted to lie down and rest. I was unable to sleep at night because of the stress.'

As well as excessive hours, Panorama found that Apple's standards on ID cards, dormitories, work meetings and juvenile workers were being breached at the Pegatron factories.

However, experts disputed the findings, and said that in fact, many of the issues are simply local customs.

'These are very complicated issues, not all of which are in Apple's control,' said Viederman, who said his firm works with Apple on the issue of migrant workers.

'Workers in China nap - and whatever the BBC found is just not indicative of conditions in China.'

Apple declined to be interviewed for the programme, but said in a statement that it strongly disagrees with the programme's conclusions.

'We are aware of no other company doing as much as Apple to ensure fair and safe working conditions,' it said.

'We work with suppliers to address shortfalls, and we see continuous and significant improvement, but we know our work is never done.'

Apple said it was a very common practice for workers to nap during breaks, but that it would investigate any evidence they were falling asleep while working.

It said it monitors the working hours of more than a million workers and that staff at Pegatron were averaging 55 hours a week.

The show featured footage of workers asleep. Apple said it was a very common practice for workers to nap during breaks, but that it would investigate any evidence they were falling asleep while working.

Poor conditions in Chinese factories were highlighted in 2010 when 14 workers killed themselves at Apple's biggest supplier, Foxconn.

Panorama also travelled further down Apple's supply chain to the Indonesian island of Bangka.

Reporter Richard Bilton found children digging tin ore out by hand in extremely dangerous conditions.

Williams conceded tin from Indonesia ends up in Apple products, and some of that tin likely comes from illegal mines, but insisted the company has taken action to hold smelters accountable.

'We spearheaded the creation of an Indonesian Tin Working Group with other technology companies.

'Apple is pushing to find and implement a system that holds smelters accountable so we can influence artisanal mining in Indonesia.

'It could be an approach such as 'bagging and tagging' legally mined material, which has been successful over time in the Democratic Republic of the Congo. We are looking to drive similar results in Indonesia, which is the right thing to do,' he added.

Miners can be buried alive when the walls of sand or mud collapse.

Twelve-year-old Rianto was working with his dad at the bottom of a 70-foot cliff of sand.

He said: 'I worry about landslides. The earth slipping from up there to the bottom. It could happen.'

Panorama tracked down a gang who collect tin from the area where Rianto was working.

One of them told the programme that they sell tin to a smelter on Apple's list of suppliers.

Apple says it is a complex situation on Bangka with tens of thousands of miners selling tin through many middle men

Panorama has previously come under fire for its reports, and was ordered to say sorry to Primark over a scene in a Panorama documentary showing boys in a Bangalore clothing workshop, by the BBC Trust.

The trust said it was 'more likely than not' that a scene, which showed the boys 'testing the stitching' on Primark clothes, was 'not genuine'.