They were way too late to make a dent. Ballmer made the mistake when the iPhone came out to not get their ass in gear to compete. Microsoft's first potential real competitor to the iPhone came with Windows Phone 7 at the very end of 2010. The iPhone was announced in January 2007 and they didn't have anything to compete until almost 4 years later. I'm not sure how they could have recovered from that by the time they gave up on Windows Phone/Mobile in 2017. Anyone who worked in mobile sales at that time knew most people who did buy a Windows Phone ended up returning it when they realized none of their apps were there. They could have had apps if they recognized the iPhone's threat earlier and reacted appropriately.
Also worth mentioning that in their time competing for mobile they did a fairly hard reset of the platform 2 more times for Windows Phone 8 and Windows 10 Mobile. Go find what developers who tried to keep up have to say