« CTIN 405 - First iPhone app | Main | CTIN 405 - news aggregator »

405 assignment 2

So this week, I was supposed to create an iPhone prototype that incorporates the ideas of space and place.

Idea:
When users twitter or take a photo, the picture or text would be tied to the GPS coordinates of its creation. Users could enter the app and see glowing nodes whose size and brightness would be relative to the user's proximity to the original location. Nodes would be created for not only the iPhone user but his or her friends' text/photos, as well.

Prototype:
My goal was to create a modifiable SQLite database that contained a user's notes and GPS coordinates (which were loaded on startup as opposed to pressing a button in the UI). I was also trying to figure out graphics that do not use the UI framework.

Execution:
I was working off of three separate examples:

1. My previous assignment for GPS
2. This tutorial for SQLite: http://icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/
3. The Apple Dev Center's GLSprite example

Unfortunately, things didn't go as smoothly as planned. I didn't get so far as the graphics, getting stuck with the SQLite and GPS combination. Here is the botched project: Download file

Some of the questions I have after this endeavor:
1. What does the CLLocation's "(id) sender" refer to and how can I incorporate it into NSTimer?
2. Will NSNumber work for holding the GPS coords?
3. What sqlite3_column_* and bind_* type works for incorporating the GPS coordinates?
4. Is there a way to print to a console or something similar for debugging?


Comments (1)

will:

Hey Logan,

So, first off -- good effort taking a stab at this, I think the overall idea sounds really cool.

I'll try and answer your questions here (we can talk more in class as well)

1) So basically, the (id)sender thing is part of a design pattern in cocoa called target-action (http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_5.html). This is basically a way for control elements (UI components, etc) to give specific instructions tied to an event. In terms of incorporating it into NSTimer, it seems like your code is doing almost the right thing. What I would probably do is a) get the location first b) when you successfully receive the location with the didUpdateToLocation delegate method, reset & start the NSTimer with the updateLoc selector.

2) The GPS coordinate is stored in type CLLocationCoordinate2D. Each type, latitude and longitude are stored in type CLLocationDegrees, which is a type double. So yes, these coordinate types (lat and lon) could be stored in their own NSNumber. Something like NSNumber *lat = [NSNumber numberWithDouble[coordinate.latitude]] should work.

3) I believe sqlite converts all NUMERIC types to double (64 bit) precision. Or you could use VARCHAR(64) I think.

4) NSLog(@"NSString of what I want to print"), or NSLog([NSString stringWithFormat:@"%d", someVariableToPrint) or printf("simple text")

Post a comment

About

This page contains a single entry from the blog posted on February 9, 2009 1:30 AM.

The previous post in this blog was CTIN 405 - First iPhone app.

The next post in this blog is CTIN 405 - news aggregator.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.31