WHAT’S IN THIS CHAPTER?
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code downloads for this chapter are found at www.wrox.com/WileyCDA/WroxTitle/Professional-iOS-Network-Programming-Connecting-the-Enterprise-to-the-iPhone-and-iPad.productCd-1118362403.html on the Download Code tab. The code is in the Chapter 5 download and individually named according to the names throughout the chapter.
Thus far, you have learned about networking iPhones with other systems under the implied assumption that things just work. In this chapter you discard that assumption and dive into the real world of networking. In this real world, things go wrong, sometimes extremely wrong: Phones move on and off networks; packets get lost or delayed; network infrastructure fails; and there is the occasional user error. Writing a networked iOS app would be much easier if things just worked, but unfortunately that isn’t the case. This chapter reviews some of the things that can cause networked operations to fail. It discusses how the system informs the app of the failure, and how the app should gracefully inform the user. A software pattern that is helpful in handling errors in a clean and consistent manner without requiring error handling code in the application logic is also described.