Search code examples
xcodedebugginglldbfoundationnsrange

lldb throwing error: use of undeclared identifier 'NSMakeRange'


If I pause an app's execution and try this command in the debugger: po NSMakeRange(0, 1) I receive the error:

error: use of undeclared identifier 'NSMakeRange'
error: 1 errors parsing expression

I tried using expr @import Foundation to no avail.


Solution

  • Use the next create NSRange variable:

    e NSRange $range = {.location = 2, .length = 1}
    po range
    

    But as explained here iOS, "NSRange is just a forward declaration and I do not know the real symbol for the implementation". That is why you may have issues with using this range variable in the debugger.