The deserted four-storey block is bleak and austere. Beyond electronic security checkpoints are dank corridors with peeling paintwork, pools of fetid green water and stark dormitory rooms filled with cold steel bunk beds and metal lockers.
At the end of each long corridor of about 50 rooms are communal showers, where 20 people at a time would queue to wash side by side, using foot pedals to pump water, and rows of squatting toilets set above open drains running the length of the space.
It could be mistaken for a prison or a labour camp, but this Shanghai block was not home to criminals or political dissidents. Rather, it contained dormitories used by migrant workers at Pegatron, a company that makes a significant proportion of the world's iPhones.
This and three other dormitory blocks on the site, which once housed up to 6,000 employees of the Taiwanese company, were vacated three months ago as a result, workers tell us, of declining orders from the key client, Apple.
Until February, the complex on Kangqiao Road East was one of the largest of about 10 off-site dormitory blocks that, along with six on-site, housed the 50,000-plus workers at the company's vast Shanghai factory. Numbers had dwindled to about 1,000 at the time of its closure. The abandoning of the dormitory blocks allowed us rare access and an insight into the living conditions of migrant workers who leave their homes to make the world's most sought-after electronic gadget.
Paid basic salaries of 2,350 yuan (HK$2,785) for six-day weeks, which they can double by working daily overtime, Pegatron's workers are drawn from China's poorest provinces, many living year-round in dormitories provided by the company.
A 20-minute shuttle-bus ride from the factory, the Kangqiao Road East complex was patrolled by teams of security guards and strictly off-limits to outsiders. Today, however, just a handful of guards remain to watch over the largely deserted buildings.
Earlier this month, we inspected one of the dormitory blocks, floor by floor, and found living conditions that Apple is investigating and Pegatron has admitted were "unacceptable".
We find rooms containing up to 12 bunk beds - Apple rules state that no more than eight workers should share a room - for which the occupants would each have been charged 160 yuan a month, deducted from their pay packets. Even when stripped of personal belongings, there is barely space for anything in the rooms other than the beds and the workers' metal lockers.
In the corner of some toilet blocks and corridors are pools of filthy green water. Throughout the block, walls are moulding, the paint peeling heavily in places, with hand-written signs posted at regular intervals spelling out rules for workers.
The men's and women's sections are segregated, with a padlocked high fence separating the drying areas for laundry on the rooftop. Throughout the building we find mementos of the young lives lived here: above one bed in a women's dorm is a strip of photo-booth shots of a boyfriend holding a flower. On a stairwell, there are discarded plastic Christmas trees and a jumble of mattresses.
Rise of the robots: 60,000 workers culled from just one factory as China’s struggling electronics hub turns to artificial intelligence
On the ground floor are workers' cafés, food stalls, a grocery shop with stock still on the shelves and, ironically, one selling Apple products, all of which are padlocked, left as if the complex had been evacuated at short notice. Electronic swipe-card checkpoints identical to the ones used by workers to clock in and out of the Pegatron factory remain lit up but redundant at the block entrance.
The closure of the dormitory blocks - a converted factory complex used for years by Pegatron - saw hundreds of workers sent home and told not to return, according to one of the remaining security guards.
"There were 6,000 workers here at its peak but orders from Apple have been getting less and less in the past two years, so the company decided to close the whole dormitory complex here," he says. "It all happened very quickly as the New Year holiday came around and they seemed to have made their minds up that there wasn't enough work to keep the dorms going."
Last month, Apple announced it had sold 16 per cent fewer iPhones than in the same period in 2015 and made 18 per cent less money from them. The iconic smartphones account for nearly two-thirds of Apple's overall revenue. A month earlier, the state-run China Daily newspaper reported that Pegatron - which shares iPhone production with another Taiwan electronics giant, Foxconn - had imposed a hiring freeze because of disappointing iPhone 6 sales, which, it said, "waned considerably", particularly in the huge China market.
LIVING CONDITIONS AT THE Kangqiao Road East dormitory complex were experienced first-hand by an undercover investigator for the pressure group China Labor Watch, who got a job making motherboards on an Apple production line last year.
"The dormitories were terrible," says the 28-year-old investigator, who spent 10 days living in the complex in September. "There were 12 workers in each small room with no toilet and no washing facilities. There were hundreds of workers on each floor but only one toilet block and one shower room for each floor. In the morning, or at the end of a working day, workers had to line up to use the toilets and line up to wash and take showers.
"The toilets were dirty and the showers were shared, with no way to give you any privacy. There was no way to relax after a hard day of work and you were given no dignity as a human being.
"Every day, many workers quit their jobs. They felt it was too hard to carry on working there. I found that most of the workers who left did so not because of the low wages but because of the harsh working conditions and the bad living conditions in the dormitories."
The investigator calculates each storey could accommodate 602 people but there were only 30 toilets, 30 showers and 50 wash basins on each floor. About half of the toilets would be out of order at any given time, he says, leaving just one toilet for every 40 workers.
"Many of the workers have red spots all over their bodies due to bug bites," wrote the investigator in his report for New York-based China Labor Watch.
As tired workers poured out of the factory gates at the end of their overtime shifts on a Saturday night earlier this month, some met us in surrounding cafés and teashops out of sight of factory security staff to tell us about the conditions.
One 28-year-old from Jiangxi province, who has been at Pegatron for four years and lives in an on-site dormitory, says bitterly, "The bosses here treat us like robots to make money for them. They should take care of us and provide us with decent living conditions but we are charged 160 yuan a month for a small room. There are eight of us in my dorm so that means they make 1,280 yuan from our room alone every month."
A young couple from Henan province talk to us as they sit eating 10- yuan bowls of spicy noodles in a café near the factory entrance.
"We moved out and rent a small flat together near the factory," says the 22-year-old man, who claims he has worked at Pegatron for 18 months. "Those dormitories aren't fit for people - they're only fit for livestock.
"We pay 850 yuan a month now compared with 320 yuan for the two of us in the dormitories, so it's hard for us but it's worth it because it means we can live like humans."
Another worker, who lives in one of the dormitories outside the factory complex, tells us, "The biggest problem with the off-site dorms isn't that they're dirty and crowded. It's the crime. They aren't safe and security staff can't keep control of them.
"People come from different provinces and gangs from one province will share a dorm together," says the 25-year-old. "They steal all the money and valuables from other workers. Some workers have their salaries stolen the day they're paid and then they have no money left for the month and have to pick leftovers out of the rubbish bins to live."
Taxi driver Zhou Xinyi, who lives and works in the Pegatron factory district, says, "I get many girls from the factory asking me to take them to Shanghai's red-light area when they finish work. They can't make enough money to feed their families working in the factory so they have to work as prostitutes."
Pegatron was the focus of a 2014 BBC investigation, which accused the company of forcing workers in Shanghai into illegally long hours and filmed some of them asleep at their work stations. Apple said it strongly disagreed with the programme's conclusions.
In an apparent response to the criticisms by the BBC and China Labor Watch, Pegatron this year gave a Bloomberg photographer a tour of its Shanghai factory, showing off, among other things, new electronic clocking-in terminals, which, it says, cut down on illegal overtime. Access to the dormitory blocks was not granted.
After seeing our photographs, a spokesman for Pegatron says the conditions shown "are not acceptable, do not comply with the code of conduct that we diligently follow, and do not reflect current conditions of our existing dormitories".
"For the past few years, we have been building modern dormitories on campus and continue renovating existing dormitory facilities with the aim of providing a comfortable environment for our employees. A maximum of eight employees per room is permitted in the dormitories and each sleeping room is equipped with fire-control facilities according to national standards, air conditioning, hot water 24 hours a day, security services, free Wi-fi and cleaning services six days per week.
"In addition to our continuous efforts to improve dormitory conditions, we also systematically monitor our employees [to ensure they] work no more than 60 hours per week. Employees' health and safety has always been our No1 mission and we will continue to invest in our employees and make sure our facilities have the most innovative features to ensure the best quality of life, health and safety."
Neither Pegatron nor Apple responded to questions about whether the closure of the dormitory block was in response to falling orders for the iPhone, although a Pegatron spokesman says the buildings have been closed "for efficiency reasons".
An Apple spokeswoman says the American company is looking into conditions at the vacated dormitory block, but stresses it has a strict code of conduct for contractors such as Pegatron, which includes a rule that there should be no more than eight workers to each dormitory, which should be "clean and safe and provide reasonable living space". Workers should also be provided with "reasonably accessible and clean toilet facilities" as well as sanitary dining facilities.
She provides a statement from Apple's chief operating officer, Jeff Williams, which appeared in the company's 2016 Supplier Responsibility Report: "We are deeply committed to making sure everyone in our supply chain is treated with the dignity and respect they deserve. Our team works hard to raise the bar every year to improve working conditions, provide educational opportunities, push for higher standards of living, and protect human rights."
Although the volume of work Pegatron carries out for Apple may have declined, a 28-year-old migrant worker from Sichuan province says she has been told to expect more shifts from next month.
"We've been told to expect more orders from Apple and we've been told there might be more jobs available if our friends back home are interested," confirms a 21-year-old. "We don't know why and they haven't told us."
The spike in orders may be linked to the rumoured launch of an iPhone 7 in the autumn, something neither Apple nor Pegatron are prepared to entertain questions about. If the rumours are true, however, the global reception the latest gadget receives may determine whether more worker dormitories in Shanghai are opened or abandoned in the months and years ahead.