ios - How to set the condition of conditional breakpoints in Swift with self and enum? -


i have enum of http methods:

enum httpmethod: string {   case = "get"   case post = "post" } 

and have request class , request wrapper class:

class request {   let method: httpmethod = .get }  class requestwrapper {   let request: request    func comparetorequest(incomingrequest: nsurlrequest) -> bool {       // next line conditional breakpoint set.      return request.method.rawvalue == incomingrequest.httpmethod   } } 

i set conditional breakpoint on line:

return request.method.rawvalue == incomingrequest.httpmethod 

with condition:

self.request.method == httpmethod.post 

and debugger stop @ line error message:

stopped due error evaluating condition of breakpoint 1.1:      "self.request.method == httpmethod.post" couldn't parse conditional expression: <expr>:1:1: error: use of unresolved identifier 'self' self.request.httpmethod == httpmethod.post 

and if delete self , change condition to:

request.method == httpmethod.post 

error message following lines:

stopped due error evaluating condition of breakpoint 1.1:   "request.method == httpmethod.post" couldn't parse conditional expression: <expr>:1:1: error: not find member 'method' request.method == httpmethod.post ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

is there way solve question?

update:

it's able check value of self.request.method using lldb command:

fr v self.request.method 

and if use local constant store value, debugger can stopped @ right position:

// use local constant store http method let method = request.method  // condition of breakpoint method == httpmethod.post 

update 2:

i using xcode 6.3.1

this pretty lldb bug. don't mention version of tools using. if aren't using 6.3.1 or better, please try again using that. if still seeing problem, please file bug http://bugreporter.apple.com.

note, frame var , expr pretty different beasts. frame var prints values of local variables, using dwarf debug information directly, not expression evaluator. instance, doesn't know enough ==. imagine if did:

(lldb) self.request.method == httpmethod.post 

when stopped @ breakpoint see same effect.

the expression parser has play trick of posing method of class (to transparent references through self, etc work) and, little tricky right. apparently aren't doing job correctly in case.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -