I was recently asked to create a small application that would retrieve the serial number from a connected iPhone (or an iPod Touch for that matter). I thought it would be a trivial task until I realized that the UDID isn’t the same as the serial number. It didn’t take long to get the UDID from the device with IOKit but getting the serial number wasn’t an option. I told my client that it wasn’t ‘possible’, meaning it’s not possible unless you are willing to do some hacking and reverse engineering. However I usually don’t give up that easily so I started looking at the iPhone Configuration Utility from Apple and found out that it uses a framework called MobileConfigKit.framework. After poking around with class-dump I decided to try to use it in my own app. I was able to get it working by changing the @executable_path using install_name_tool and overwriting a few methods.
I would of course never ship an app using a private framework by Apple but since it was only for this particular client I didn’t feel too bad.
If anyone knows a better way to do this I’d love to hear about it and also if you’re interested I might be able give you some more hints.