Apple (AAPL) - Get Report CEO Tim Cook is on a tour of China, meeting with politicians, shaking hands and taking pictures. Cook is also pledging to create the company's first research center in the country, as Apple attempts to turn around dwindling sales in the world's second-largest economy. 

The center will open later this year and focus on developing new products and services while "strengthening relationships with local partners and universities," an Apple spokesman told The Wall Street Journal

This isn't the first investment in China Apple has made this year. The company pledged a $1 billion investment in Chinese ride-hailing company Didi Chuxing Technology in May.

The impetus for these investments is apparent. Apple is struggling in China. 

"While Apple's online sales in China are still growing, our proprietary data suggest that its total Greater China sales is likely to be weaker than consensus expectations" for the third quarter of fiscal 2016, analysts at T.H. Data Capital said in a recent note. "We assume that Greater China sales will account for 24.7% of Apple's total sales, the same proportion as last quarter, in which case the consensus expectation for Apple China sales in CY2Q16 could be $10.5 billion. We believe China sales can be weaker than the Street expectation."

Apple reported a 33% drop in Greater China sales (China, Hong Kong and Taiwan) to $8.8 billion in its most recent quarterly earnings report. Last year, the company reported 112% growth during the same period. The decline represented the company's largest regional drop, contributing to the company's second consecutive quarter of total revenue declines. 

The reasons for Apple's inability to gain much traction are numerous, including strong competition from China-based smartphone manufacturers and government scrutiny bordering on harassment. 

Earlier this year, China shut down Apple's iBooks Store and iTunes Movie services just six months after their launch as China looked to tighten its control of the media disseminated in the country. Then in May, a court in Beijing ruled that Xintong Tiandi Technology was the legal owner of the trademark for the word "iPhone" in China after being approved for the trademark in 2010. Apple applied for the trademark for electronics in 2002, but the bid was not approved until 2013. 

Xintong Tiandi Technology doesn't make phones, or even technology, it makes accessories, and it currently uses the word iPhone on some of its leather goods. 

Apple isn't the only U.S-based  tech company to face regulatory hurdles in China. Rival Microsoft  (MSFT) - Get Report  faced questioning from the country's antitrust regulators earlier this year, asking the company to explain "major issues" that were exposed from an investigation by China's State Administration of Industry and Commerce (SAIC).

Last year, the agency raided four Microsoft offices in China, saying the company had not fully disclosed information about its Windows and Office software suite of products. 

U.S. chipmaker Qualcomm  (QCOM) - Get Report was also fined $975 million last year by the SAIC due to supposed violations of the country's anti-monopoly laws. 

Apple and other U.S. tech companies find themselves in a precarious situation. They can't just ignore the potential 1.5 billion consumers in China. But they may also be in a position where no matter how many investments they make in the country, the political climate in China won't allow them to succeed. 

Editor's Note: This article was originally published on Real Money at 1:13 p.m. on Aug. 19.

Employees of TheStreet are restricted from trading individual securities.

Action Alerts PLUS, which Cramer co-manages as a charitable trust, is long AAPL