Why would an iOS App crash only on certain devices?
From time to time I see an app update that includes something like "crashes on iPod Touch fixed".
How can an app only crash on say the 4th generation iPod Touch, while not crashing on the iPhone 4? It was my understa开发者_开发百科nding that they both run the same OS?
If you ever try to update your iDevices with Apple's pre-released beta iOS packages, you'll notice that different iDevices have different update packages, even though with the same version number (let's say iOS 4.2.1).
So my answer is, though with the same version number, they are not exactly the same OS.
The root of it is the hardware and what's available in software as a result does differ on the devices, like any other platform (though much less so since Apple so tightly controls the hardware ecosystem here).
For a quick example (off the top of my head, since Skype just added video chat): you can't assume there's a camera facing the user, you'd crash on anything but an iPhone 4 if you did so, there need to be checks in place for various features that differ between devices.
They generally run the same OS. But, under the hood, some APIs are implemented differently, or are totally left out, in order to account for hardware differences, among other things. Therefore if apps don't account for these differences, crashes may occur on devices which the apps fail to handle properly.
For example you can forget to check if camera is present on device and try to show UIImagePickerController with camera source type. Or trying to use other functions not available on specific hardware.
精彩评论