Launching a File in Cocoa + Other Questions

Discussion in 'Mac Programming' started by bobber205, Jun 7, 2008.

  1. bobber205 macrumors 68020

    bobber205

    Joined:
    Nov 15, 2005
    Location:
    Oregon
    #1
    I've started getting serious about learning Cocoa today. I've found the API to be easy to use, but requiring alot of research to know the sometimes very long method names etc.

    What resources aside from Apple's site do you use?

    My main question is how do you "open" a file in Cocoa. Right now I have a NSOpenPanel that's working as I want, but how do I have the "OS" open that file? Like as if I've opened it on the desktop.
     
  2. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    First of all, turn on code completion in Xcode, it will make your life a lot easier in regards to remembering long method names. The resource I use most is the built-in Documentation in Xcode (Help menu). I strongly recommend you go through one of the Cocoa books and I would start with Aaron Hillegass' Cocoa Programming for Mac OS X.

    To open a file, use the NSWorkspace method openFile: or openFile:fromApplication:, or if you need additional things you can always launch using a UNIX command (like open) wrapped in an NSTask object.
     
  3. bobber205 thread starter macrumors 68020

    bobber205

    Joined:
    Nov 15, 2005
    Location:
    Oregon
    #3
    Oh man. Code completion. I've been using VS for about the last year or so steady and I've missed it today.

    Thank god Xcode has it. :D

    I am ordering the book tonight. :)
     

Share This Page