Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dtrimble

macrumors member
Original poster
Jan 7, 2008
46
3
San Francisco, CA, USA
Good morning,

Background: I'm brand new to developing applications on the iPhone, and even to the Mac, more or less. In the 1990s, I did a lot of development on PCs in VB, QB, PDS, and some moderate work in Assembly, and Perl. I know scripting on the Mac reasonably well, and most Web languages, but am new to Objective C and Apple's frameworks and SDKs. I haven't done professional-grade programming since the mid-1990s.

I'm trying to create a relatively simple iPhone app based on a script I wrote for Mac OS X. It simply fetches a URL, uses grep to find a specific file name referenced in the code and that changes regularly, and then retrieves that specific file name. In this case, it is an image file that updates on a regular basis.

Right now, I don't want to focus on making my iPhone app all shiny and iPhone-ish. I can learn how to add in the functionality for creating a cover flow view, swiping, navigation, and useful functionality after I get past rewriting the basic script commands into a working set of C code.

So my question comes down to this: is there an Objective C equivalent to the script commands for curl, grep, and cut that will work with iPhone SDK? I haven't had any luck finding them in Apple's reference documents.


Dan
 

xsmasher

macrumors regular
Jul 18, 2008
140
0
So my question comes down to this: is there an Objective C equivalent to the script commands for curl, grep, and cut that will work with iPhone SDK? I haven't had any luck finding them in Apple's reference documents.

Yes. You can grab the contents of a URL with NSString stringWithContentsOfURL: . Then you can find the image you're looking for with the Standard C Library regex functions in regex.h . Then you can display the image using a UIWebView or a UIImage.
 

chbeer

macrumors member
Sep 22, 2008
82
0
Berlin
You can also scan the string using NSScanner. That's a quite easy class for scanning strings for other strings and such.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.