The
presence of undocumented APIs is not the issue. Windows and
OS X both have undocumented APIs.
Microsoft writes many applications for Windows that are sold separately. Windows's main purpose is to facilitate the use of various applications - not just those included with the OS, and not just Microsoft applications, but those from many different vendors. Using undocumented Windows APIs in Office to gain a significant advantage over the competition would have increased the use of Office in Windows. Because Windows was the dominant PC OS and these advantages weren't available to competing software vendors, this had huge anticompetitive implications for the entire PC software market.
The iPhone is not the dominant mobile phone, nor is the iPhone OS the dominant mobile phone operating system. Apple's use of undocumented APIs does not have the same malicious competition-hurting effect as some of Microsoft's actions did.