Media playback is unsupported on your device Media caption Richard Bilton reports from Shanghai: ''An exhausted workforce''

Poor treatment of workers in Chinese factories which make Apple products has been discovered by an undercover BBC Panorama investigation.

Filming on an iPhone 6 production line showed Apple's promises to protect workers were routinely broken.

It found standards on workers' hours, ID cards, dormitories, work meetings and juvenile workers were being breached at the Pegatron factories.

Apple said it strongly disagreed with the programme's conclusions.

Exhausted workers were filmed falling asleep on their 12-hour shifts at the Pegatron factories on the outskirts of Shanghai.

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, said: "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."

'Continuous improvement'

Apple declined to be interviewed for the programme, but said in a statement: "We are aware of no other company doing as much as Apple to ensure fair and safe working conditions.

"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 it would investigate any evidence they were falling asleep while working.

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

Find out more Watch Panorama: Apple's Broken Promises on BBC One on 18 December at 21:00 GMT or later on the BBC iPlayer. BBC iPlayer

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

Following the suicides, Apple published a set of standards spelling out how factory workers should be treated. It also moved some of its production work to Pegatron's factories on the outskirts of Shanghai.

But Panorama's undercover reporters found that these standards were routinely breached on the factory floor.

Overtime is supposed to be voluntary, but none of the reporters were offered any choice. In addition to the excessive hours, one reporter had to attend unpaid meetings before and after work. Another reporter was housed in a dormitory where 12 workers shared a cramped room.

Apple says the dormitory overcrowding has now been resolved and that it requires suppliers to retroactively pay workers if it finds they haven't been paid for work meetings.

Pegatron said it was carefully investigating Panorama's claims and would take all necessary action if any deficiencies were found at their facilities.

"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," a statement said.

Dangerous conditions

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

Apple says it is dedicated to the ethical sourcing of minerals, but the programme found evidence that tin from illegal mines could be entering its supply chain.

It found children digging tin ore out by hand in extremely dangerous conditions - miners can be buried alive when the walls of sand or mud collapse.

Image caption Rainto, 12, said he was worried about landslides

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 said they sold tin to a smelter on Apple's list of suppliers.

Johan Murod, who runs one of the smelters on Apple's list, said 70% of the tin that is exported comes from the small-scale mines.

"At the smelter there's everything from both large and small scale mines. It's all mixed. There's no way to know what is legal and what is illegal."

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

"The simplest course of action would be for Apple to unilaterally refuse any tin from Indonesian mines. That would be easy for us to do and would certainly shield us from criticism.

"But that would also be the lazy and cowardly path, since it would do nothing to improve the situation. We have chosen to stay engaged and attempt to drive changes on the ground."

Watch Panorama: Apple's Broken Promises on BBC One on 18 December at 21:00 GMT or watch later on BBC iPlayer.