Learning to debug in Xcode - objective-c

Does anybody know a good place to learn how to use the debugger in Xcode? I'm hoping to understand how to use things like stack trace, the debug log, and anything else I don't really know about. Online tutorials would be best, but I'm not opposed to buying a book either. Thank you.

Read the Xcode documentation about debugging and you will know all the basics.

There was a session at WWDC 2011 called Effective Debugging with Xcode. The link is to the video in iTunes, so you should be able to watch it.
Learning to debug is really two skills: learning how to use the tools, and learning what to do with them. It shouldn't take you long to get the basics -- setting a breakpoint, inspecting values, etc. Really getting good takes much longer.

Related

What's the best way to use vim for Cocoa development?

First time poster, long time reader. I searched and found no questions that answered this question. If I missed a thread somewhere I apologize.
I've been looking at doing some serious Cocoa development for a few years now. Even attended WWDC back about 5 years ago. With the App Stores making things easier for distribution I figured now is about as good of a time as any.
There's also been a fair amount of discussion regarding Vim lately and how it can increase productivity once you get a good handle on it. So I've purchased a couple books on Vim and bookmarked a dozen or two websites that I've seen lately.
My question is what plugins or whatever could I use with Vim to make developing with Cocoa/ObjC better?
I'm familiar with the Cocoa.vim plugin, but looking at the site there it hasn't been actively worked on for around 10 months. Before I get used to the features in that plugin I'd rather look at alternatives that have seen more development (if there are any).
That said, I'm interested in any and all tips regarding Vim and Cocoa/ObjC. Any easy ways to integrate them? I know you can set MacVim as the default editor in Xcode. What else might someone be able to do? Doing a Command-R to build&run would be great (Cocoa.vim claims to do this), but again, lack of development makes me cautious.
Thanks,
gks
Install the XVim plugin for Xcode. It gives Vim-like key bindings to Xcode.
I start using Vim one month ago, so I'm not a master but I'm quite familiar now.
As a Cocoa developer, I've been also looking to integrate things better, but until now, even with cocoa.vim I think Xcode still better for "application development". With this expression, I mean developing the easy part, that is logic like designing controllers.
You may agree with me. That's the easy part. Writing IBActions and so on. We don't need many editing commands to do that, and Xcode has a lot of advantages here. The auto-completion is phenomenal, it's intelligent and reads what you have been typing like no other. And can you imagine things with Xcode 4? Dragging an outlet from the interface directly into code is something that will not be available in Vim in a recent future.
Now, when it comes to writing models with heavy logic and C things, I stick with Vim.
You see, I still need to learn a lot. I'd love to have Vim running in the exact place of Xcode editor, but while that doesn't happens I have been trying to get the best from both worlds. Xcode is not all about editing text, it's about developing and debugging and many more, and it does these things in a fantastic way.
I'll let more experienced users continue…
I use vim for every text editing job except Cocoa. I agree with the things Sidyll says about the advantages of Xcode. Xcode is a pretty decent development environment with it's native editor.
I do have my Xcode set so that a double click brings up the file in Vim. I use this for things like fairly complex find and replace with regular expressions.
Another feature I'd like to see in Xcode is support for literate programing. In Haskell I can compile a file wih lhs suffix, and run the same file through Pandoc (or txt2tags) and get an HTML or PDF version. With Xcode I have to keep my development notes in a separate file.

Textmate Code Completion Question

I know the ESC key does code completion, but is there a way to get a pop-up(tool-tip I guess) that shows you all the possible choices for a piece of code? As an example, it would be nice when writing Javascript to get a list of available actions. Other apps I've used like Coda do this. I'd like to check out Textmate but I have a hard time getting past this missing feature which I find pretty valuable, particularly as a fairly new programmer who likes to see what options are there as it's a bit of a learning tool for me also. I thought I had found a plugin like what I'm looking for, Dialog2, but it seems to have disappeared as it was meant to be built-in to the never-released TM2.
I've looked around a fair bit for the answer to this question and figured this was my next best option. Thanks.
I don't have Textmate available to try it out, but I believe that option-Esc is supposed to show you the list of possible code completions.
Check out subtleGradient's tmbundle: https://github.com/subtleGradient/javascript.tmbundle
It knows how to auto-wrap for arrays, and objects. Documentation look-up too.

Tips for transitioning from Visual Basic to Xcode

I've been programming in VB.net for a while now, and I finally got access to a mac to make ipod apps. What are some useful sites, videos, etc. that could help me get used to Objective C and the Xcode IDE? I've stumbled upon the samples on the apple dev site, but none of them really give good examples which I could learn the syntax of the language from.
Thanks for the help, Objective C is really a big change from VB.net!
Here are some helpful starter references from the Apple site, first for Objective-C itself, then for the Cocoa frameworks.
Learning Objective-C: A Primer
Cocoa Fundamentals Guide
There are also "getting started" videos available from http://developer.apple.com/iphone (you have to register as a developer to get access, but that's free)
You might want to take a look at MonoTouch if you like working with .Net. As far as I'm aware, it only works with C#, but it will let you use the .NET api to program for the iPhone. Might be worth looking into if you don't want to learn Objective C.

When should you start using an IDE when learning a language? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I didn't find a question on this while searching SO but if anyone does please tell me.
There are alot of questing on the pros and cons of IDE's and what IDE to use for this and that language, like "Why should I use an ide?" and "Are we too dependent on our IDE's?".
But as a beginner just starting to understand how to build GUI's with Swing and getting a grip on the workings of event handlers and whatnot I started to wonder, when should you actually start using an IDE to further productivity and not stifle the learning experience?
The intellisense function is really helpful but sometimes makes me feel lazy for not thinking that extra bit and looking things up in the book im reading or the api documentation.
However the ability to set flags in the code to step trough to find logical errors and actually go into the parent method are sometimes useful to get a better understanding about what goes on in the code.
I read somewhere that you should have a good grasp on the basics of a language before using the IDE, but what is the basics? And what is good?
The only downside to using an IDE would be using its tools and wizards and not understanding how the code they generate works. If you are using an IDE for code completion, syntax highlighting and debugging then that's great. If you are using it to generate GUIs that you can't build by hand or generate Web Service code that you don't know how it works, then that's bad. But that's bad regardless of whether you're a beginner or not.
Your instincts are right. Understand how things work and how to code things by hand before just trusting the tool blindly.
An IDE is a tool you should use from the start. Understanding how languages work is important but memorising every little detail, not so much. A builder would no more learn how to make a mud hut with his barehands before building something with power tools than you should learn to program without using an IDE.
That said, you should be aware of what the IDE is doing for you so that in circumstances where you are faced without one, you know the things you need to make up for. An IDE can't write good code for you, it can't even tell you how to write good code, or suggest good code, it can only supplement your own skillset (at least right now, in 2009 - I can't speak for our robot IDE overlords of 3452).
Don't start with an IDE. Here's why:
I learned Java using Notepad and the command line. If I needed to know what methods a particular class had, I looked at the APIs online.
I did that for about half of a semester. Then we switched to Eclipse.
Doing it that way, I became very familiar with the Java syntax, lots of the core libs, and how the Java 'compilation' and running process works.
People should never develop this way long term as it is terribly unproductive. But I feel it is the correct/best way to begin learning a language.
Don't start with an IDE.
I would suggest using an IDE right off the bat...but not worrying about most of the functionality. As you learn the language and become more familiar with processes, aspects of the IDE will suddenly become obvious at the right times.
I don't think you should get too hung up on delaying using an IDE. Let's face it, in the real world, you'll be using that IDE pretty much all the time.
When you're initially learning, I think the most important thing is to use the IDE, but know what it's doing.
For example, when Visual Studio.NET first came out, and I played with it and wrote my first "Hello World" app, then clicked the "green go button" (!), I watched the output window with all of it's information. I then looked at the help documentation to see that this is really just calling out to csc.exe and piping it's text output back into an IDE window. So I went off and started invoking csc.exe myself from the command line and saw it's parameters that it would accept. Then I jumped back into the IDE and saw how GUI checkboxes related to the csc.exe parameters.
This way, I started using the IDE straight away, but also learnt what the IDE is doing with regards to "shelling out" to command line based utilities.
From here, I even tried typing my first C# program in Notepad and compiling it from the command line. But I wouldn't get too hung up on it, though. Let's face it, in the "real world" you're very unlikely to need to do it. I was good to scratch the itch of my curiosity, though!
IDE saves you time and energy. I have no problem of using IDE even as beginner. It only helps.
If you know the ide well, it will help you explore a new language/technology that it supports.
If you don't know the ide, better don't use one at first. Use a simple text editor (notepad++ on windows), command line, and the official reference.
I think that you should be able to manually do anything that the Intellisense is doing for you automatically. For example, you should know what function you want to type before hitting Intellisense.
Well, if you're expirienced in other languages or just might have worked with them, then use IDE right away.
But for complete beginners, I wouldn't suggest it.
It doesn't have to be one or the other - try both. Life's short enough ;-)

Other than Xcode, are there any full functioned IDEs for Objective-C? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I know and have Xcode, but I was wondering if there were any other complete development environments that support Objective-C? I'm not looking for solutions with vim or emacs, nor editors like BBEdit that support syntax highlighting, but a full fledged IDE with:
code completion
compilation
debugging
refactoring
Extra points for being cross platform, supporting vi key bindings and supporting other languages.
Note:
I've updated and accepted my answer below as Jetbrains has released Early Access for AppCode, their new Objective-C IDE. Since this has been a fairly popular question, I thought it worthwhile to update the information.
I recently learned that Jetbrains the make of my favorite IDE (Idea) may support Objective-C (though it is unclear how much it will work for iPhone/iPad development). See the thread here for early discussion on this.
In the last year or two, they have started adding additional language support both in their flagship IDE as well as specialized IDEs (for Ruby, Python, PHP). I guess this is just another step in the process. I for one would love to have another option other than XCode and I couldn't think of one that I'd love more.
This is obviously vaporware at the moment, but I think it is something to keep an eye on.
This is now a real product, albeit still in Early Access. See here for a the blog on this new product, which will give you pointers to check out the EAP.
UPDATE: AppCode has now been released and offers a true alternative to using Xcode for Objective-C and iPhone/iPad/Mac development. It does still rely on Interface Builder for layout and wiring of GUI components and uses the iOS simulator, but all coding, including a slew of refactorings, smart templating and static analysis, is available through App Code.
Textmate is an editor like BBEdit but it has the ability to run commands such as compilation, debugging, refactoring (though it will do so via XCode). It also has code completion.
In addition, you can write your own commands for Textmate that you can then run.
I have been searching for something like this that does NOT run on mac for quite a few months now. Unfortunately I think that due to the relative obscurity of the Objective-C language that nobody has ever bothered producing such a full featured IDE for it. Until now, and we only have Xcode.
Using JBuilder I fell in love with the auto-completion and displaying the function 'hints' on the screen while I type. I am that sort of person who remembers the 'ideas' better than the actual syntax and really benefits from knowing right then and there that the code I typed was correct, not having to find out a minute later at compile time. And then to have to try and figure out if I just misspelled something, or if I truly made a conceptual error due to a misunderstanding of proper use of the language. Code completion and hints have always saved time on this for me.
I know some people may look down on this and say the feature is unnecessary if you know what you're doing, but I never claimed to be better than anyone else.
I may have to just give up and try and get OS X running on my PC. Which doesnt bother me in the least, just the rebooting to go back and forth to windows. I've tried to run it virtualized under VMWare but XCode kept crashing :( That reminds me I am going to google 'leopard vmware' and see if any progress has been made in that area.
Another problem in designing a full code-completion system with objective C is that the syntax is a little more forgiving, I dont know the exact technical term (strongly typed?) it is much harder to say exactly what sort of object belongs in a certain parameter and ANY object can be sent ANY message whether it implements that function or not. So you can spell a function name wrong, but it doesnt necessarily mean you made a syntax error... maybe you mean to call a function of that OTHER name and you just want nothing to be done if the function is not implemented by your object.
That's what I would really like to see for Objective-C, is an IDE that once it notices you are sending a message to an object, it displays a list of methods and function definitions that the object is known to accept, and walks you through filling in the parameters.
I think you would waste less time by sticking with Xcode rather than looking for another IDE if you want to develop for the Mac (or iPhone).
Apple made a lot of effort to kill any competitor in that area to make sure any developer wanting to develop for the Mac platform use Xcode and only Xcode.
It might not be the best IDE but it does work well and it is the IDE developers at Apple are using. Somehow it does its job. The frameworks and the documentation are very well integrated.
I use TextMate a lot and also SubEthaEdit but they are not full IDE as you’ve described above.
Best Regards.
Check out JetBrains' new IDE called "App Code". It's still in the Early Access Program, but even with the Early Access bugs it is hands-down better than xcode 4. I've been using it for commercial iPhone and iPad development.
http://www.jetbrains.com/objc/
I would like to second Troy's answer and note that JetBrains has AppCode in early access, so you can try it for free. It has the familiar UI of their other products, and yes, it supports vi! So far it has been very good. I have run into a few issues, and a few vi-isms that don't work quite right, but it is still better than suffering with Xcode. I do text editing with syntax completion in AppCode, but switch back to XCode to get into the GUI builder which is actually quite good in Xcode.
If you are an old vi-guy like myself, it is invaluable.
The short answer is: No. There are thousands of IDEs but Xcode is the only one which you seriously can name IDE. I suggest you have a look at the tries of GNUStep (in form of Projectcenter, Gorm) and then you can imagine the state of affairs.
I believe KDevelop is the only full IDE that supports Obj-C, but I'm not even sure how fully it supports it, having never used it myself. Worth a shot, maybe.
There are a few programmers text editors that support Objective-C, but I like Editra, mainly because I also write Python on Windows\Nix and it has great features. Editra runs well on all platforms and has a nice plug-in that supports Mercurial, GIT, and Subversion if you need them. Another nice thing, its written in Python. Editra Home
Found another, though it sounds less than ideal:
ActiveDeveloper - doesn't appear to have active support (last update was in 2006). Mac only.
KDevelop sounds like it only supports Objective-C syntax and only through its C support. I'm going to check it out anyway.
Textmate has a couple screencasts for Objective-C (here and here). It is Mac only, but otherwise looks pretty good. It is hard to tell from the screencast how strong the integrated support is as it seems to just have a lot of scripts to handle the code. Also, I can't tell if it does true code completion or just expansion for snippets.
So it doesn't look like there is anything out there that hits everything. I'll probably do most of my development on Mac, so I'm thinking I'll try out TextMate with XCode to see if it is any better than straight XCode. I'll take a quick look at KDevelop.
Thanks.