Questions tagged [nslog]

Logs an error message to the Apple System Log facility.

The message consists of a timestamp and the process ID prefixed to the string you pass in. You compose this string with a format string and one or more arguments to be inserted into the string. The format specification allowed by this function is that which is understood by NSString’s formatting capabilities.

Displaying log messages in the system console while running your application is one of the oldest debugging mechanisms available. Using logging, you can generate a transcript describing the operations being performed by your application that you can review long after your application has finished running. Also, while your application is running, you can observe log messages being generated and written to the console as the events in your app they describe are taking place. As a developer, you are in complete control of the text and information displayed in the console by NSLog. Logging can reveal even the toughest to find problems in an app.

Here is an example of what a call to NSLog looks like:

NSString *message = @"test message";

NSLog( @"Here is a test message: '%@'", message );

Console:

Here is a test message: 'test message'

Reference:

Basic debugging with the NSLog function and the DEBUG preprocessor macro

666 questions
-1
votes
3 answers

Remove NSLog header

Below is a typical NSLog output from the console. Can I get rid of the bold text? 2013-06-09 22:17:02.351 ProjectName[33584:907] MyWantedText I want to cut out the console text, and compare it (by diff), to a similar log. I don't want time data etc…
Fredrik Johansson
  • 1,211
  • 1
  • 12
  • 22
-1
votes
1 answer

NSMenu is null when called from another class

I have NSMenu of a status bar app, defined in AppDelegate.h like this: IBOutlet NSMenu *spotMenu; @property (nonatomic, retain) IBOutlet NSMenu *spotMenu; And in AppDelegate.m like this: [spotApp setMenu: spotMenu]; - (NSMenu *)…
grep
  • 535
  • 5
  • 16
-2
votes
2 answers

how can NSLOG display multiple variables in one line

i have three NSString variables NSString *text1; NSString *text2; NSString *text3; NSLog(@"%@"text1, text2, text3); This displays only text1 variable How can i display all of them in NSLog in one single line? Thanks
-2
votes
1 answer

How to send NSLogs when a user presses a button or does something

I'm making an application for someone, and theres some things I'd like to monitor. I have NSLogs all set in place for each action, but I want to be able to send those to a console or something. Is there anyway of doing this? Also I don't want the…
-2
votes
1 answer

Objective C get item from object

I have this code: NSLog(@"%@", [self.tableData objectAtIndex:indexPath.row]); and in my logs it returns this: 2015-09-01 15:21:58.581 App[1253:560973] { Name = "PDF-Folder"; Type = Directory; } my question is how do I just get the Name ?
user979331
  • 10,209
  • 56
  • 186
  • 339
-2
votes
1 answer

adding an NSMutableArray to NSMutableDictionary

I am trying to add NSMutableArray's to a NSMutableDictionary My code looks something like this: [myDictionary setObject:[NSMutableArray array] ForKey: myKey]; [[myDictionary objectForKey:myKey] addObject: myString]; So what I am trying to do: I…
-2
votes
1 answer

Whats wrong with this code? Objective C

I can't seem to get this to work, I want this to display (The value of myXYPoint is,2,4) Here's my code. I keep getting this in my output area (lldb). This is from the exercise in the book programming in objective c by stephen g kochan, pg50…
-2
votes
2 answers

iOS app crash when trying to log NSDictionary

I have a problem where I try to log NSDictionary content and as soon as the method is called the app crashes. This is the code I have tried after advice from a talented "hacker": %hook UserData -(int)getVariable:(NSDictionary *)fp8 { for (NSString…
-2
votes
1 answer

NSLog Printing (null) for object?

I am using delegation to pass an object from my AssignmentViewController to my TableViewController whenever my Save button is pressed. I am trying to print out the content of the object that I should have just saved and passed over, but NSLog is…
Mike
  • 479
  • 2
  • 7
  • 24
-2
votes
3 answers

called NSLog's function's location in project

I have a big project and there are many NSLog() calls. When something happens some NSLog() works, and I don't know which NSLog get called. How can I find a place where is NSLog() get called in class file? My NSLog is like this: NSLog(@"%@",…
Shamsiddin
  • 2,153
  • 4
  • 21
  • 34
-2
votes
2 answers

word after the space NSlog

I am new bie to xcode may be question is silly but I am lagging with my home work. In a file I want to read a specific character after the string. I want to read all the character after the space. ex: asasasasasas wewewewewewe qwqwqwqwqwqw xyz_…
DD007
  • 1
  • 3
-2
votes
2 answers

Issue with NSLog when printing BOOL type

(XCode 4.3) Why does the following crash at the NSLog statement with EXC_BAD_ACCESS? BOOL autoFlag @property BOOL autoFlag @synthesize autoFlag [object setAutoFlag:YES] NSLog(@"%@", [object autoFlag]); //crashes here in debugger with…
raffian
  • 28,859
  • 25
  • 95
  • 164
-3
votes
2 answers

How do i display the output of NSURLSession using NSLog?

I want the display the output of a URl using NSLog. ViewController.h @interface ViewController : UIViewController{ NSURLSession *session; NSString *londonWeatherUrl; NSURLRequest *request; } ViewController.m - (void)viewDidLoad { [super…
Tejas K
  • 593
  • 8
  • 26
-3
votes
4 answers

Can NSLog be disabled from appearing in device's console?

I have a builded application that is running on device. I open device's console view in XCode's Organizer window. I assume (for the sake of this question) that NSLog(@"Some string") gets called. Is there any way, may be an option in device, or…
Max Yankov
  • 10,076
  • 10
  • 54
  • 116
-3
votes
2 answers

NSLog not printing out BOOL result to console

I have a location app that already successfully asks the user to enable location services, and then can show them their coordinates on a button press as well. So I decided to play around with everything that is available in the CLLocationManager…
user3117509
  • 823
  • 3
  • 13
  • 30
1 2 3
44
45