Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log only what I print in Xcode

Tags:

xcode

ios

While building an iOS app in Xcode, how do I set the log to show only what I print()?

I am wasting a huge amount of time sifting through garbage that looks like this

2016-10-18 06:26:49.455995 Lunch[1559:32097] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0 2016-10-18 06:26:49.458682 Lunch[1559:32097] subsystem: com.apple.UIKit, category:

I end up using hacks like print("SEARCHFORME") so I can use the find command and search for messages I need while debugging.

like image 550
ThisClark Avatar asked Oct 18 '16 11:10

ThisClark


People also ask

How to view logs from a specific application?

if you want to view logs from just your application then you can make a custom method that keeps saving the log to a file in documents directory & then you can view that log file from your application. There is one good advantage for developers of the app after the app has been released & users are downloading it.

How to enable NSLog in Xcode?

Or #define NSLog (s,...) The console is hidden by default every time Xcode starts up. (I mean, when you start debugging, the debug area shows just the variables.) There's a button on the right hand end of the debugging toolbar to show the console, or you can use View menu -> Debug Area -> Activate Console.

How can I display a URL in Swift with Xcode?

NSString* url = @"someurlstring"; printf ("%s", [url UTF8String]); By using printf with the appropriate parameters, we can display things this way. This is the only way I have found to work on online Objective-C sandbox environments. In Swift with Xcode you can use either print () or NSLog (). print () just outputs your text. Nothing more.

Is there a way to debug Objective-C code in Xcode?

This is the only way I have found to work on online Objective-C sandbox environments. In Swift with Xcode you can use either print () or NSLog (). print () just outputs your text. Nothing more. NSLog () additionally to your text outputs time and other useful info to debug console.


1 Answers

Go to -> enter image description here

Edit Scheme -> Run -> Environment Variables -> set Name to - OS_ACTIVITY_MODE and Value to - disable.

enter image description here

like image 94
KAR Avatar answered Oct 15 '22 08:10

KAR