I've been working through the Stanford iPhone Coding course and currently hooking into the Twitter API. What I'd like to do is accurately handle two error conditions: One for when the username is invalid, and another for when the device is not currently connected to the internet. Unfortunately, as it stands, the best I can surmise is whether or not the return from the API is nil or not - which is the case for both conditions.
What I'm looking for is a line or two of code that can check for a connection before attempting any fetch of remote data. I could sift through the Apple documentation but I figured: Why not put the question to you guys for my benefit and perhaps that of others?
Additional info: Using Objective-C and the iPhone SDK in XCode.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…