How to develop apps?

Discussion in 'Jailbreaks and iOS Hacks' started by yayaba, Sep 10, 2007.

  1. yayaba macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #1
    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.
     
  2. rwdebes macrumors 6502

    Joined:
    Jun 28, 2007
    #2
    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.
     
  3. carlos1078 macrumors newbie

    Joined:
    Sep 1, 2007
    #3
    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.
     
  4. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #4
    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.
     
  5. carlos1078 macrumors newbie

    Joined:
    Sep 1, 2007
    #5
  6. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #6
    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...
     
  7. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #7
    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.
     
  8. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #8
    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.
     
  9. The General macrumors 601

    Joined:
    Jul 7, 2006
    #9
    Maybe your Hello World app doesn't run because it doesn't have execute permission. chmod +x it via ssh or MobileTerminal, then try.
     
  10. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #10
    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.
     
  11. carlos1078 macrumors newbie

    Joined:
    Sep 1, 2007
    #11
  12. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #12
    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.
     
  13. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #13
    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 :)
     
  14. carlos1078 macrumors newbie

    Joined:
    Sep 1, 2007
    #14
    Very cool- nice work! If you could send me or post your makefile, that would be awesome.
     
  15. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #15
    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!
     
  16. The General macrumors 601

    Joined:
    Jul 7, 2006
    #16
    Let me know when you're ready to start writing a Simon game for the iPhone. :D
     
  17. skierdb526 macrumors regular

    Joined:
    Sep 13, 2007
    #17
    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
     
  18. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #18
    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.
     
  19. skierdb526 macrumors regular

    Joined:
    Sep 13, 2007
    #19
    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.
     
  20. badtzmaru macrumors 6502

    Joined:
    Jul 1, 2007
    #20
    great thread, as soon as i get my mac mini up and running to my liking, i am going to start coding!
     
  21. yayaba thread starter macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #21
    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!
     

Share This Page