Go Back   MacRumors Forums > Archive > Wasteland

Closed Thread
Thread Tools Search this Thread Display Modes
Old Jan 31, 2013, 04:37 PM   #1
macrumors newbie
Join Date: Jan 2013
New Objective-C Tutorial

Hey iOS devs!

I just published a comprehensive Objective-C tutorial at: http://rypress.com/tutorials/objective-c/

I thought it would be a very useful reference for the beginning developers hanging around the MacRumors forums.

If any experienced programmers have the time to read through it (or part of it) over the next few weeks, feedback would be greatly appreciated.

ryanhodson is offline   0
Old Jan 31, 2013, 11:39 PM   #2
macrumors 603
ArtOfWarfare's Avatar
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
I read the section on Errors and Exceptions.

I have to confess, I've never use any error/exceptions in Obj-C... and the excessive use of them is what makes me call C++ and Java ugly languages.

Is there any situation in which it'd be appropriate to actually @throw an exception?
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0
Old Feb 1, 2013, 12:29 AM   #3
Thread Starter
macrumors newbie
Join Date: Jan 2013
@throw is useful if you're writing a public library for others to use, since it lets the programmer know when they passed an invalid argument, when an internal state has been corrupted, or when something else has gone fatally wrong and the app needs to crash.

In application code, you should pretty much always use NSError instead of NSException.

I'll be sure to edit the tutorial to make that clearer. Thanks!
ryanhodson is offline   0
Old Feb 1, 2013, 01:08 AM   #4
macrumors 6502
Join Date: Jun 2010
Location: @
Just to follow up on exceptions -- I generally look to the built-in frameworks and APIs to get a sense of what idiomatic iOS code should look like.

In that sense using exceptions to throw errors across a library boundary looks very unusual.

Your tutorial looks very detailed; I will have a proper look later
My App Store Apps: Dashometer, Exinf, Score&Grade
ianray is offline   0
Old Feb 1, 2013, 01:24 AM   #5
Thread Starter
macrumors newbie
Join Date: Jan 2013
I was actually thinking of it from that perspective. For example, when you try to access an NSArray element that doesn't exist, it throws an exception so you know you did something bad.

To clarify, you shouldn't ever use @throw to communicate an *error* across a library boundary, but it would be appropriate for a library to throw an *exception* for the programmer to catch.

Correct me if I'm wrong, and let me know if you have any other feedback. Thanks!
ryanhodson is offline   0

Closed Thread
MacRumors Forums > Archive > Wasteland

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
imovies tutorial ?? Sriteja25 MacBook Pro 3 Sep 11, 2013 03:00 PM
Picstitch Tutorial? hewhodareswins iPhone/iPad Programming 2 May 23, 2013 08:00 PM
Imovie Tutorial Anyone? mortmonster Mac Basics and Help 8 Oct 29, 2012 02:39 PM

Forum Jump

All times are GMT -5. The time now is 09:28 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC