佳为好友

转:关于处理XCode的错误和警告的tips

10-3-12

转:http://www.bit-101.com/blog/?p=2237

XCode tips


[Note, XCode 3.2 did away with the Errors and Warnings Smart Group. :( Its functionality is now moved to the Build Results Window. I'll probably write an update to this whole setup soon.]

After a few months of working with XCode, I’m starting to fine tune my set up to make it easier to code, compile and debug. A couple of tips for today on dealing with compile errors. Say you compile and you have an error in your code. Don’t laugh. It could happen. With the default setup, you’ll get something like this:

xcode-1

At first those little bubbles seem kind of neat, but after a while, you will hate them. They persist after you fix an error, til the next build, unless you double click on them, and it’s like driving with a bug on the windshield. So first thing we do is turn them off.

xcode-2

Now, you’ll still get the red x, which you can click on to see the bubble if you want. But we’ll soon see something better.

xcode-3

The next problem is, what if the error(s) isn’t in the file that is currently shown in the editor? You see down in the lower right corner that your build failed with one error, but where is it? Well, you can click that message, which opens the Builds Results window.

xcode-4

You see this shows and describes the error in the top part of the window, and opens the file in the file itself in the bottom. So no need for the bubbles anymore. A few things I don’t like about this though. Most of all, I already have an editor window open. I don’t like having this other floating window with another editor. The other thing is that the top window shows not just errors and warnings, but the whole build process, so if you have a few errors, you kind of have to pick them out in a long list of other messages. It’s not too hard, but I’ve found yet a better way. The Errors and Warnings Smart Group. Set this to open up automatically any time you have errors or warnings:

xcode-5

Now, if you have errors, they will appear in that group, that group will be selected, and in the details window at the top of your editor, you will get a list of all errors and warnings, and nothing else. Click on any error and it will open up in your main editor window. Furthermore, you can look at the group itself to see which files have errors. In this case it’s just one error in the App Delegate file, but if there were problems in multiple files, they would all be listed in the smart group, and you can click on a file in that group to just see the errors in that particular file.

xcode-6

The final thing I do is change the position of this smart group. By default it is placed way down under Targets and Executables. In this simple example, which only has a single class, it’s no problem, but when your classes group and resources group contain a whole bunch of items, and those are expanded, the Errors and Warnings group will be way down out of sight. But when it’s selected, the whole Groups and Files panel will scroll down to show it, and when you’re done you have to scroll up again to get back to your files. A minor thing, but what I do is just drag the Errors and Warnings group up to the top.

xcode-7

Following the settings image above, it will automatically if you have no errors or warnings, so it’s never in the way, but opens up and is selected and above everything else when you DO have problems. Right where you want it.

So some minor tweaks, but I find it streamlines development quite a bit. You have errors, they show up in a list at the top details panel right away, with the list of files in the top left. Click on an error and the file is displayed, right at the particular error. No nasty bubbles in your way.



+++++

posted on 2012-12-23 10:15 佳为好友 阅读(314) 评论(0)  编辑 收藏 引用 所属分类: Debug-GDB


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

<2012年12月>
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

留言簿(1)

随笔分类

搜索

最新评论

评论排行榜