大佬教程收集整理的这篇文章主要介绍了ios – 如何设置Swift中有条件断点的条件与自我和枚举?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
enum httpR_443_11845@ethod: String { case GET = "GET" case POST = "POST" }
class request { let method: httpR_443_11845@ethod = .GET } class requestWrapper { let request: request func compareTorequest(incomingrequest: NSURLrequest) -> Bool { // Next line is where the conditional breakpoint set. return request.method.rawValue == incomingrequest.httpR_443_11845@ethod } }
return request.method.rawValue == incomingrequest.httpR_443_11845@ethod
条件:
self.request.method == httpR_443_11845@ethod.POST
Stopped due to an error evaluaTing condition of breakpoint 1.1: "self.request.method == httpR_443_11845@ethod.POST" @L_673_10@n't parse conditional expression: <EXPR>:1:1: error: use of unresolved identifier 'self' self.request.httpR_443_11845@ethod == httpR_443_11845@ethod.POST
如果我删除自己,并将条件更改为:
request.method == httpR_443_11845@ethod.POST
错误信息如下:
Stopped due to an error evaluaTing condition of breakpoint 1.1: "request.method == httpR_443_11845@ethod.POST" @L_673_10@n't parse conditional expression: <EXPR>:1:1: error: @L_673_10@ not find member 'method' request.method == httpR_443_11845@ethod.POST ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
有没有办法解决这个问题?
更新:
可以使用LLDB命令检查self.request.method的值:
fr v self.request.method
如果我使用本地常量来存储值,调试器可以停在正确的位置:
// Use a local constant to store the http method let method = request.method // Condition of breakpoint method == httpR_443_11845@ethod.POST
更新2:
我正在使用Xcode 6.3.1
注意,框架var和expr是相当不同的野兽. frame var仅打印局部变量的值,直接使用DWARF调试信息,但不是表达式求值程序.所以,例如,它不够了解==.我想像如果你这样做:
(lldb) self.request.method == httpR_443_11845@ethod.POST
当在那个断点停止时,你会看到相同的效果.
表达式解析器必须扮演一个额外的技巧,作为你的类的方法(通过自我等获得透明的引用),而且这是一个有点棘手的事情.显然我们没有在你的情况下正确地做这个工作.
以上是大佬教程为你收集整理的ios – 如何设置Swift中有条件断点的条件与自我和枚举?全部内容,希望文章能够帮你解决ios – 如何设置Swift中有条件断点的条件与自我和枚举?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。