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

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
I've been thinking to jump into the wonderful world of native iPhone application development and was wondering if there were any tutorials out there or reference guides on how to start building this stuff.
 

rwdebes

macrumors 6502
Jun 28, 2007
254
0
if you are asking, you probably have no idea how to develop an iphone app..
its not like a photoshop tutorial , you just copy and get the same results.
 

carlos1078

macrumors newbie
Sep 1, 2007
15
0
if you are asking, you probably have no idea how to develop an iphone app..
its not like a photoshop tutorial , you just copy and get the same results.

I humbly disagree. I am also interested in this, am familiar with C/C++, comfortable with gcc, etc., but would really appreciate it if there was a brief summary somewhere of relevant information. I believe there's a toolchain out there for compiling iPhone code on my Mac, though I'm not sure where it is. Are there other gotchas when compiling code to the iPhone? Is it as simple as compiling the app. on your computer, packaging it according to instructions I saw on http://iphone.nullriver.com/beta/ and transferring it to your iPhone? I believe this is the info. the original poster was interested in, and I would be very interested as well.
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
if you are asking, you probably have no idea how to develop an iphone app..
its not like a photoshop tutorial , you just copy and get the same results.

Well, I'm not looking for something as simple as a photoshop tutorial. I know how to program in C/C++ and was hoping to start learning some objective C by tinkering with the toolchains.

carlos, thanks, that's indeed what I was looking for. I see some very, very basic guides out on the net to get the toolchain from SVN sources and to try to compile them but was hoping there was a binary toolchain out there that I could jump start into.
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
Interesting.

Looking around, I found the place to download the toolchain binaries so we won't have to go through the hassle of compiling it. I believe the binaries are at 0.2 as well though I cannot verify that...

Toolchain located at: http://iphone.natetrue.com/ and I downloaded the iPhoneToolchainV05.dmg file.

Next, looks like it requires a decrypted firmware file so I'm currently looking into that.

Some useful links I stumbled upon:

http://www.oreillynet.com/mac/blog/2007/07/how_to_compile_for_your_iphone.html
http://iphone.fiveforty.net/wiki/index.php/UIKit_Hello_World

Edit:
Decrypting firmware was possible with instructions at
http://landonf.bikemonkey.org/code/iphone/Toolchain_In_MacPorts.20070812.html

Very simple and straightforward. Now to try and compile something...
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
Just to keep this a running log of my findings:

So I was able to compile the latest Toolchain on OSX using Nightwatch's very thorough directions on the following google code group:

http://code.google.com/p/iphone-dev/wiki/Building

It takes about 30-45 mins to check out the entire thing from SVN and to build.

To get SVN (a source control system), just google it and install it.

Everything should build ok. I had to modify my path variables somewhat since one of the shell script files for the installer simple just calls "svn" and so I had to add the path where svn installed to to my path.

I got a sample HelloWorld app to build but I can't seem to run it. I'm not sure how to get apps bundled either. I downloaded a prebundled app and ripped out the exe and replace it with my own. But when I try to run my compiled app it just crashes and boots me back to the springboard.

Hopefully soon I'll be able to get something to compile and run ok and then I can start looking at some source code to figure some stuff out.

Oh yeah, for some reason I had some makefile problems with the one included with the HelloWorld package I downloaded. I think the syntax for the makefile was incorrect or I had some extra spaces or tabs as no matter what I did, I couldn't get it my compiler to recognize the makefile. After using another project's, it worked out ok.
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
I always used SendSpace to send files back and forth to my phone because I thought that FTP would be hard to setup but it's not hard at all. Plus SendSpace has problems sending .app files for some reason so I had to figure out how to use FTP.

Turns out it's not too hard. From directions from modmyiphone.com, OpenSSH needs to be installed from Installer.app. Then, they use the Cyberduck SFTP client for OSX. Connect to your iPhone's IP, set username to root, pw to dottie, then connect. First time will take awhile but after that, it's as easy as drag and drop to move files.
 

The General

macrumors 601
Jul 7, 2006
4,825
1
Maybe your Hello World app doesn't run because it doesn't have execute permission. chmod +x it via ssh or MobileTerminal, then try.
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
Maybe your Hello World app doesn't run because it doesn't have execute permission. chmod +x it via ssh or MobileTerminal, then try.

No, it has the right permissions. I can tell that Springboard is launching it but for some undetermined reason it's crashing.

The source looks ok. I'm guessing something else is the culprit here but I have yet to determine what.
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
FYI- TUAW just had a blog entry on developing for the iPhone, and they included a link to a binary toolchain- http://www.tuaw.com/2007/09/11/installing-the-iphone-developer-toolchain-a-simple-how-to/

I'm going to install it and try compiling some software, now that I've got ssh running on the phone.

Let me know how that goes. I had tried the binary toolchain but couldn't get very far as I didn't know that the makefiles had to be updated.

I'm wondering what version of the toolchain version5 is though. 0.2 or 0.3? I'm currently using 0.3 from svn.
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
Sweet. Got it to work.

I pulled the absolute latest from SVN as of an hour ago, built the toolchain, and compiled a sample navbar app I got from TUAW. It was able to build and I SFTP'ed it over to my Apps folder and it runs.

If anyone needs to look at my makefile let me know as I had problems with a lot of makefiles and finally got mine to work ok. Man what a painful process.

Time to start coding and see what I come up with :)
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
Here's my makefile:

Code:
CC=/usr/local/bin/arm-apple-darwin-gcc
CXX=/usr/local/bin/arm-apple-darwin-g++
CFLAGS=-fsigned-char
CPPFLAGS=-Wall
LDFLAGS=-W1,-syslibroot,/usr/local/share/iphone-filesystem -lobjc -ObjC -framework CoreFoundation -framework Foundation -framework UIKit -framework LayerKit -framework CoreGraphics
LD=$(CC)

all:	Hello

Hello:	mainapp.o SampleApp.o
	$(LD) $(LDFLAGS) -o $@ $^

%.o:	%.m
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

clean:
	rm -f *.o Hello

I'm not sure what everything means in the header section but just make sure the CC points to the correct compiler and the LDFLAGS point to the right heavenly location.

I haven't tried with the binary toolchain (version 4 or 5) but hopefully it works. Building from SVN is pretty straightforward but it does take like an hour to check out everything and build. Good luck!
 

skierdb526

macrumors regular
Sep 13, 2007
131
0
I do not know that much about programming yet (taking intro computer science), but i would like to be able to build apps once I get an iphone. From what I know you use objective-c. is there anything else I need to know as far as language goes? any great books people recommend?
Thanks
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
I do not know that much about programming yet (taking intro computer science), but i would like to be able to build apps once I get an iphone. From what I know you use objective-c. is there anything else I need to know as far as language goes? any great books people recommend?
Thanks

IMO I think it will be kind of hard. Yes the apps are built in ObjC but there is no official SDK (software development kit) by Apple, only a very, very basic one that has no documentation. So a lot of it is programming the dark.

Still, picking up an ObjC book would be the first step.
 

skierdb526

macrumors regular
Sep 13, 2007
131
0
I agree with you. I have no idea how to do it at this point. Basically Im hoping I can get my prof interested in it (he just bought an ipod touch, so i hope it gets hacked soon) and i can kind of learn from experiance as well as learning language from the book. Just a hope.
 

badtzmaru

macrumors 6502
Jul 1, 2007
473
2
great thread, as soon as i get my mac mini up and running to my liking, i am going to start coding!
 

yayaba

macrumors 6502
Original poster
Apr 24, 2007
297
0
San Francisco Bay Area
So one weird thing I ran into is that the toolchain I grabbed from the SVN is missing some header files. I tried to build an app that required the MusicLibrary header files and discovered I was missing them.

I checked the binary version of the toolchain and the header files are in there. So looks like I'm going to have to copy over stuff and try it out.

I know things are still early but it is pretty frustrating getting a good development environment up and running for the iPhone. But still, big kudos to the people that make this stuff possible in the first place!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.