How can I find a line number in Xcode?

后端 未结 8 1617
小鲜肉
小鲜肉 2021-02-03 16:53

I have a function in my *.m file

- (void)myFunction {}

How can I find the line number this function?

8条回答
  •  我在风中等你
    2021-02-03 17:26

    This can also be done through code when your implementation file grows. I have found this very useful to track and debug through tedious code. NSLog(@"\nFunction: %s\t\tLine: %d\n\n",func, LINE);

    For example, in some class called MyClass:

    - (void) someFunction {
        NSLog(@"\nFunction: %s\tLine: %d\n\n",__func__, __LINE__);
    }
    

    ==== Output ===

    Function: -[myClass someFunction]          Line: 175
    

提交回复
热议问题