Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 中的用户断点 #1943

Merged
merged 2 commits into from
Jul 26, 2017
Merged

Xcode 中的用户断点 #1943

merged 2 commits into from
Jul 26, 2017

Conversation

atuooo
Copy link
Contributor

@atuooo atuooo commented Jul 23, 2017

初稿完成 #1925

@leviding
Copy link
Member

校对认领 @sqrthree

@linhe0x0
Copy link
Member

@leviding 好的呢 🍺

@fengzhihao123
Copy link

校对认领@sqrthree

@linhe0x0
Copy link
Member

@fengzhihao123 妥妥哒 🍻


![A regular breakpoint](https://pspdfkit.com/images/blog/2017/user-breakpoints-in-xcode/regular-breakpoint@2x-a201ce1c.png)

These breakpoints are stored inside the personal settings for this particular workspace or project and are visible only for you, even if you commit your personal settings to the project. Colleagues working on the same project will not see your breakpoints in their Xcode.
这些断点保存在特定工作区或工程的个人设置中,仅自己可见。即使你将个人设置提交到项目中,在同一个项目中的同事的 Xcode 中也不会看到你的断点。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在同一个项目中的同事的 Xcode 中也不会看到你的断点 -> 在同一个项目中的同事也不会在他们的 Xcode 中看到你的断点


Everybody uses breakpoints in Xcode, but are you aware of user breakpoints? I am going to show you how to use them and what to use them for. If you already know what user breakpoints are and how to use them, check out the list at the end of the article and see what we use them for at PSPDFKit. Maybe there is something new for you to add to your list!
(这里的 User Breakpoints 是译成 "个人断点" 好呢,还是 "用户断点" ?)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉用户断点好一点


- **Symbol:**`UIViewAlertForUnsatisfiableConstraints`

Automatically stops on auto layout constraint issues. This brings much more attention to the issue that otherwise would just print a log message in the console inside Xcode. It helps a lot with identifying layout issues early.
当出现自动布局约束的问题时自动停止。这会让我们更加关注这个问题,否则就会在 Xcode 中打印一个日志消息。它有助于及早地发现布局问题。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这会让我们更加关注这个问题,否则就会在 Xcode 中打印一个日志消息 -> 这会比仅仅在Xcode的控制台输出一条打印信息更让你注意这个问题


- **Symbol:**`-[UIViewController initWithNibName:bundle:]`
*Debugger command:*`po $arg1`

Prints the class of a view controller during its initialization. When working on large projects or if you are new to a project, you do not know all the names of the view controllers. If you are trying to figure out what the name of the view controller is that you want to make changes to, just activate this breakpoint and then navigate the app to the view controller in question. You will see the name of it printed in the console.
在视图控制器初试期间打印其类型。当在大型项目中工作或者你是个新来的,你会不知道所有试图控制器的名字。如果你想知道你要修改的视图控制器的名字的话,你只需激活这个断点,然后在应用中导航到这个视图控制器,你会在调试器中看到所打印的名字。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在视图控制器初试期间打印其类型 -> 在视图控制器初始化期间打印其类型

Copy link
Member

@leviding leviding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -3,80 +3,81 @@
> * 原文作者:[Michael Ochs](https://twitter.com/_mochs)
> * 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner)
> * 本文永久链接:[https://github.com/xitu/gold-miner/blob/master/TODO/user-breakpoints-in-xcode.md](https://github.com/xitu/gold-miner/blob/master/TODO/user-breakpoints-in-xcode.md)
> * 译者:
> * 译者:[oOatuo](https://github.com/)
> * 校对者:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -3,80 +3,81 @@
> * 原文作者:[Michael Ochs](https://twitter.com/_mochs)
> * 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner)
> * 本文永久链接:[https://github.com/xitu/gold-miner/blob/master/TODO/user-breakpoints-in-xcode.md](https://github.com/xitu/gold-miner/blob/master/TODO/user-breakpoints-in-xcode.md)
> * 译者:
> * 译者:[oOatuo](https://github.com/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


## A Regular Breakpoint
大家应该都用过 Xcode 中的断点,但你们熟悉用户断点么?下面我将向你们如何使用以及何时使用这种断点。如果你已经对个人断点有所了解了,可以查看下文章后面的清单,看看我们是如何在 PSPDFKit 中使用它们的,也许有一些新的东西可以添加到你的清单中!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下面我将向你们如何使用以及何时使用这种断点。=> 下面我将向你们介绍如何使用以及何时使用这种断点。


## A Regular Breakpoint
大家应该都用过 Xcode 中的断点,但你们熟悉用户断点么?下面我将向你们如何使用以及何时使用这种断点。如果你已经对个人断点有所了解了,可以查看下文章后面的清单,看看我们是如何在 PSPDFKit 中使用它们的,也许有一些新的东西可以添加到你的清单中!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

个人断点还是用户断点?
统一一下吧
感觉用户断点好些


Another slightly less useful thing you can do with this: add a shared breakpoint in a commonly executed code path of your app, such as the completion of a network request, make it continue automatically and let it play a sound every time it is hit – yes, you can make your breakpoints play sounds. Commit and watch your co-workers go nuts when they try to figure out where that sound is coming from! 😁 Sadly trolling your co-workers is the one thing that doesn’t quite work in a remote environment, which is why I have not done that at PSPDFKit... but that might be something to entertain for [our retreats](https://pspdfkit.com/blog/2016/the-importance-of-retreats-for-a-remote-company/).
另一个你可以用它来做的稍微不那么有用的事:在应用程序的执行代码路径中添加一个共享的断点,比如完成一个网络请求,让它自动地继续运行,并让它在每次被击中时播放一个声音 - 是的,你可以让你的断点发出声音。提交断点,然后看着试图弄清楚声音是从哪里来而抓狂的同事!😁 不过,在远程工作的环境下,恶搞你的同事是很难的,这就是我为什么没有在 PSPDFKit 这么做。。。但可以在[我们的线下团建](https://pspdfkit.com/blog/2016/the-importance-of-retreats-for-a-remote-company/)时拿来娱乐一下。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

让它自动地继续运行 => 让它自动地连续运行


- **Symbol:**`-[UIApplication sendAction:toTarget:fromSender:forEvent:]`

Stops when an event is delivered, such as the touch of a button. This is pretty similar to the one above. Activate this breakpoint if you do not know what method a button calls on touch. `p (SEL)$arg3` will print the selector that is invoked and `po $arg4` the target it is invoked on.
当有事件发出时中断,例如按钮的触摸。这和上面那个很相似。激活这个断点,如果你不知道按钮被触摸时调用了哪个方法的话。`p (SEL)$arg3` 会打印出调用的选择器,`po $arg4` 会打印调用它的目标。

- **Exception Breakpoint:** Objective-C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否需要翻译?


- **Symbol:**`-[UIApplication sendAction:toTarget:fromSender:forEvent:]`

Stops when an event is delivered, such as the touch of a button. This is pretty similar to the one above. Activate this breakpoint if you do not know what method a button calls on touch. `p (SEL)$arg3` will print the selector that is invoked and `po $arg4` the target it is invoked on.
当有事件发出时中断,例如按钮的触摸。这和上面那个很相似。激活这个断点,如果你不知道按钮被触摸时调用了哪个方法的话。`p (SEL)$arg3` 会打印出调用的选择器,`po $arg4` 会打印调用它的目标。

- **Exception Breakpoint:** Objective-C
*Debugger command:*`po $arg1`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否需要翻译?


- **Exception Breakpoint:** Objective-C
*Debugger command:*`po $arg1`

Stops when an Objective-C breakpoint is hit, printing the exception to Xcode’s console.
Objective-C 断点被触发时中断,并打印相应的异常信息。

- **Exception Breakpoint:** C++
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否需要翻译?


- **Exception Breakpoint:** C++

Stops when a C++ exception is hit.
C++ 异常抛出时中断。

- **Swift Error Breakpoint**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否需要翻译?


- **Swift Error Breakpoint**

Stops when a Swift Error is encountered.
Swift 错误出现时中断。

- **Symbol:**`_XCTFailureHandler`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否需要翻译?

@linhe0x0
Copy link
Member

@fengzhihao123 校对完了吗?

@fengzhihao123
Copy link

校对完成@sqrthree

@linhe0x0
Copy link
Member

@atuooo 两位校对者都已经校对好了~ 可以来根据校对意见进行调整了哈 ┏ (゜ω゜)=☞

@atuooo
Copy link
Contributor Author

atuooo commented Jul 26, 2017

@sqrthree 修改完成

@linhe0x0 linhe0x0 merged commit 3e03cf1 into xitu:master Jul 26, 2017
@linhe0x0
Copy link
Member

已经 merge 啦~ 快快麻溜发布到掘金专栏然后给我发下链接,方便及时添加积分哟。

@atuooo
Copy link
Contributor Author

atuooo commented Jul 27, 2017

cdadar pushed a commit to cdadar/gold-miner that referenced this pull request Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants