How can I find a line number in Xcode?

IosXcodeXcode4

Ios Problem Overview


I have a function in my *.m file

- (void)myFunction {}

How can I find the line number this function?

Ios Solutions


Solution 1 - Ios

You can go to:

Xcode > Preferences > Text Editing

then tick "Line numbers". Go to your method and you'll see the appropriate line number shown in the left-hand border of the text editor.

Solution 2 - Ios

Go to Xcode Preferences > Text Editing > Show: Line numbers to show the line numbers on the editor.

Solution 3 - Ios

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

Solution 4 - Ios

If you type command L and enter the desired line number, then you can jump to the line number in Xcode 5.

Solution 5 - Ios

In Xcode 7

>Xcode > Preferences > Text Editing
>check the Line numbers

Solution 6 - Ios

Still applies in Xcode 8

Xcode > Preferences > Text Editing

Solution 7 - Ios

Shortcut cmd+L. Enter line number.

or

cmd+O. $CLASS_NAME:$LINE_NUMBER.

And your XCode goes to the line and highlights it!

Solution 8 - Ios

Keep Xcode top on Mac-Screen than press "command" and "comma key btn" a xcode preferences popbox will open given below:enter image description here than click on "Text Editing" menu below given window will open enter image description here here you on top written "show" with "Line numbers" just check it and thats it.

Happy Coding!!!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVoloda2View Question on Stackoverflow
Solution 1 - IosSimon WhitakerView Answer on Stackoverflow
Solution 2 - IosneilvillarealView Answer on Stackoverflow
Solution 3 - IosLuffyView Answer on Stackoverflow
Solution 4 - IosAdam FreemanView Answer on Stackoverflow
Solution 5 - IosjacinthView Answer on Stackoverflow
Solution 6 - Iosmouness2020View Answer on Stackoverflow
Solution 7 - IosIllya KritView Answer on Stackoverflow
Solution 8 - IosMRizwan33View Answer on Stackoverflow