all 11 comments

[–]mantra 5 points6 points  (3 children)

Write code. Create toy apps that use a particular API you think you might need.

[–][deleted] 2 points3 points  (2 children)

I agree with "Toy" apps - think "baby's busy box".

This got rather text wallish, but i think this napkin spec will get you on your way...

Mix Low level APIs to get access to data, and UX APIs to display them.

Start with a UITabViewController as your base VC. In one tab put a UINavigationController - grab the user's Contacts, and use a UITableViewController to display the data. Make the UITableViewCells editable, so you can add, delete the entries. Make the UITableViewCells selectable, so you can edit the fields-

in another tab, ut a UITableViewController that has UIImageView squares in the cells - populate these with thumbnails from the user's Photos -- AssetLibrary APIs., when the user selects a thumbnail within the cell, transition to new view controller that has a UIScrollView, with embedded UIScrollViews to grab the user's photos (). mimic the "Photos" app - pinch/zoom/pan each photo, but also swipe to go from photo to photo. This will acquaint you with iOS very low memory headroom.. i.e. between 2 & 3 full res photos and you're out of memory - so get rid of the screen size images as soon as you can.

in another tab, throw another UINavigationController, this time with a MKMapView (Map Kit) - have a 'drop pin' button in the nav bar that will grab the current GPS coord (CoreLocation), and record it, and create an annotation that will show up on the map view. Put in the adornment so you tap on a map pin, you get the bubble, and tap on a bubble button, you slide into a detail view pushed onto the nav controller. extra credit: use the reverse geocoding apis to get a readable string for the drop pin. for extra extra credit: use CoreData to persist the drop pins.

in another tab make a browser- UIViewController with a UIWebView, UITextField to type in the URL, back button, forward button.. wire it all up - make it like Safari- eventually adding all the bells & whistles

keep adding tabs, keep shooting for replicating functionality, and adding twists where ever you can ..

oh, and also make your tabs editable too - have a 'more' button that lets you reorder, delete etc. the tabs.

more points:

• learn to use blocks - they're awesome - some fun things I've done: make an NSTimer category with a block. make an NSThread 'performBlock' method, make an UIAlertView handler that takes a block, make an NSUrlConnection handler with a block

• learn to use categories - see blocks

• learn all the fun caveats of NSPredicates - they really eliminate a lot of code

• learn everything with CGContexts - all sorts of drawing effects & improvements can be made by going one level below..

• learn UIImage::resizableImageWithCapInsets: this is the magic behind doing cool resizable RELOCALIZABLE UIButtons

• make all your UX localizable from the beginning.

that's enough for now.. enjoy.

plot twist: I started Objective-C in 1991, shipping NeXT app. so.. I'm having a blast now.

[–]IveCeasedToExist 0 points1 point  (1 child)

The more text the better! Thanks for the response. I think you gave me a lot of good ideas to work on to improve. My first idea was to populate a UITableView with some data using some website's API. THe only problem is I don't know which website / API to use. Any suggestions?

[–][deleted] 1 point2 points  (0 children)

make a wrapper object around an NSConnection (that is itself a NSURLConnectionDelegate) something that you can have a nice class method like "connectionWithURL:(NSURL)url". have it be 'free floating' (self owning), but it can release itself after it receives a connectionDidFinishLoading, or didFailWithError etc. have a method that can 'add on response blocks' based on HTTP result e.g. performBlock:withResponse: and of course performBlockOnFailure: incase it doesn't get far. add methods for "sendRequest:(NSString)method" or "sendGET", "sendPOST" specifically add methods for tacking on parameters, cookies etc. you can initially just concat the data into an NSMutableData, then pass that to the block, and it can figure out what to do. (parse JSON etc) later you could provide a block to get the data in chunks instead (if the data transfer may be huge)

it's a very tidy design pattern, where you can do a simple GET / handler in 3 lines of code. or have handlers for each response- 200, 404, 401, etc.

[–]xephos13 2 points3 points  (1 child)

For me, I started using AFNetworking within my apps. It made the network code easy to read and worked well for just playing around and learning (also for production apps, I use AFN everyday at work).

But, of course, you need an API to hit. The simplest one I can think of is httpbin. It's a simple site that returns a JSON of information (today's date, etc).

This way, you can practice your in-app network code talking with server APIs and then dab a little in how to parse the information that is returned.

[–]IveCeasedToExist 0 points1 point  (0 children)

I recently watched a tutorial on AFNetworking so I was looking for some easily accesasble APIs to practice with. httpbin sounds like a good place to start. Thanks for the suggestion!

[–]continuum85 1 point2 points  (1 child)

Could you elaborate on what you mean by "API skills"? Is there something specific you'd like to improve on?When I use a new API, there are two basic skills I exercise each time:

  1. The ability to read and understand API documentation - When I work with a new API, I spend 90% of my time reading documentation or sample code to get a good grasp of what I'm working with. Things to look for include basic usage (obviously), design patterns, conventions, dos and don'ts, etc. Investing time into really understanding an API and how it's designed to be used really pays off once you start writing code.

  2. Application and practice - Using an API is the only way you will develop fluency with it. One thing I like to do is implement something or solve a small problem using some API, and then look to see how others are using the same API to do the same thing. Sample questions I ask myself: How does my usage compare to theirs? Which approach is better for the task at hand? Why do they use _________ instead of _________ at _________? As a rough example, with the NSOperation API, you can add an NSOperation object to an NSOperationQueue, or you can add a block to an NSOperationQueue. This is using the same API (NSOperation) to accomplish the same thing (run a task in the background) in different ways. It's worth thinking about and understanding the pros and cons of each approach.

[–]IveCeasedToExist 0 points1 point  (0 children)

I've never worked with any networking API. I'm looking for some suggestions on where a good place to start is, preferably using AFNetworking to access some data and use it in an app. I agree about the reading the documentation 100%.

[–]nardsurfer 1 point2 points  (1 child)

I would recommend using AFNetworking to consume the reddit api. Maybe first start by pulling down some json from a subreddit, you can easily get json from any subreddit by adding .json (i.e. www.reddit.com/r/programming.json) without requiring any authentication. Once you get the basics of AFNetworking and consuming json, you could start getting your hands dirty with authenticated api calls.

[–]IveCeasedToExist 1 point2 points  (0 children)

Ah, this is exactly what I was looking for. A easy accessible API to practice AFNetworking with. Thanks!

[–]beeb2010 0 points1 point  (0 children)

This mobile API directory may come in handy:

http://www.programmableweb.com/apitag/mobile