Apple Inc will boost its investment in China, one of its most important but increasingly difficult markets, and build its first Asia-Pacific research and development centre in the country, Chief Executive Tim Cook said on Tuesday.

Demand for Apple's phones has plummeted in China, and the government maintains a wary attitude towards foreign technology. This is at least the CEO's second trip to the country in four months.

Apple's new research and development centre will be built by the end of the year, Cook told Vice Premier Zhang Gaoli, one of China's most senior officials, according to the official Chinese state broadcaster.

The pledge comes after the head of China's industry and technology regulator in May told Cook he hoped Apple could deepen its cooperation with the country in research and development and stressed information security.

Apple did not immediately respond to a request for comment.

Sales in Greater China, once touted as Apple's next growth engine, decreased by a third in its most recent quarterly results, after having more than doubled a year earlier.

Not only is a slowdown of the world's second-largest economy stoking concerns, but the company's stores for books and movies also went dark in China earlier this year. Apple has also lost intellectual property battles and faced anti-U.S. sentiment from consumers.

Before Cook's charm offensive in Beijing in May, Apple announced a $1 billion deal with ride-hailing app Didi Chuxing, a move many experts saw as an attempt to curry favour with Beijing.

Other tech firms have in the past pledged investment in China while facing difficulties in the country, including Microsoft Corp and Qualcomm Inc, but often with mixed results.