"It was the best of times, it was the worst of times." The opening line from Dickens' A Tale of Two Cities succinctly frames the way people of that Victorian age regarded the sometimes-up, sometimes-down state of the world they lived in.

The famous line is also a handy paradigm for thinking about consumer-electronics giant Apple (Nasdaq: AAPL) -- a company in the midst of unprecedented success, and a company in the midst of unprecedented challenge.

His man Cook
Overshadowing all other Apple news in 2011 was the death of Steve Jobs. Happily, there was no succession drama and the reins of CEO were pre-emptively handed over to veteran COO Tim Cook, who had been Jobs' top lieutenant and the logistics magician who streamlined the company's supply chain, fattening up margins and helping make Apple the enormously profitable enterprise it is today.

Cook knows the company as well as, if not better than, Jobs himself did. He's also as disciplined a leader and as hard a worker as was Jobs. Cook, however, is no Steve Jobs when it comes to product vision. This point has been made again and again, but it bears repeating.

Jobs wasn't a one-man show. Jobs hired the best people in their fields, who brought him their best ideas in the execution of his broad vision. But his true brilliance lay in knowing perfectly which of those ideas to pursue and which to abandon. That's what made all the difference for Apple, and it's what Cook might not bring to the role of CEO.

That's, like, so last year
Consumers and industry analysts alike have come to expect big Apple product news every year. Even with Jobs' illness and subsequent death, 2011 would be no exception. But when the company failed to launch an iPhone 5 over the summer, fielding instead an upgraded version of its iPhone 4, there were murmurs that the company was already losing its innovative edge -- a key contributing factor to its moat in the highly competitive world of consumer gadgetry.

People still lined up to get their hands on the latest iPhone, but Apple's share of the smartphone market slipped from 16.6% to 15% last year, leaving Samsung as the world's largest manufacturer of smartphone handsets. And Google's (Nasdaq: GOOG) Android operating system accounted for 52.5% of market share in the third quarter of 2011, a number that doubled from a year earlier.

Then there's the new smartphone alliance of Nokia (NYSE: NOK) and Microsoft (Nasdaq: MSFT). Nokia's new high-end phone, which uses Microsoft's operating system, will be introduced in the states in 2012 (at the upcoming CES, anyone?). Initial reviews of the sleek Nokia handset and distinct Microsoft OS have been positive.

Another Apple success story, the iPad, also faces stiff competition in the form Amazon.com's (Nasdaq: AMZN) Kindle e-reader. One model, the $199 Kindle Fire, operates well enough as a tablet computer, at an attractive enough price point, to be a possible threat to the much more sophisticated and more expensive iPad. Amazon is reporting that it sold more than 1 million Kindles per week in December.

My kingdom for a horse, or at least another moat
Opining recently on Apple, industry analyst Rob Enderle of the Enderle Group told the Financial Times: "[This] ... is going to be a pivotal year. ... Apple for the last decade has clearly led the market and now the market has proved to be very good at being a 'fast follower.'" In the same piece, Tim Bajarin, president of the research firm Creative Strategies, told the newspaper that "2012 could be another big product year for the Apple, rivaling 2010 when the iPad was launched."

So it's the best of times for Apple, and it's the worst of times. Well, maybe no one would argue it's the worst of times for a company that recently touched the top spot by market capitalization. I think it's fair to say that the company has challenges ahead for this year but is well placed to handle them.

For the fiscal year ending in September, Apple raked in a staggering $108 billion in revenue, up from $65 billion the year before, netting out as $26 billion in profits. Apple's $82 billion war chest is a moat in and of itself.

Plus, given Jobs' long period of physical decline, he no doubt helped plan out at least the next few years of the company's direction. So, in a sense, Jobs' singular vision is still at work in the company, with Cook doing what he's always done best: executing it.

But Apple isn't the only company well positioned to cash in on the booming smartphone and tablet PC markets. Learn about three more, handpicked by our Foolish analysts, in this special free report: "3 Hidden Winners of the iPhone, iPad, and Android Revolution." Get your copy while it's still available.