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

667 questions
0
votes
2 answers

iPhone: NSLog self.window.rootviewcontroller

I need to know my winow.rootviewcontroller name. For example UITabBarController *demoTabBarController = [[UITabBarController alloc] init]; [self.demoTabBarController setDelegate:self]; self.demoTabBarController.viewControllers = [NSArray…
Jay Pandya
  • 507
  • 6
  • 26
0
votes
1 answer

How to get current center point when I move view using CGAffineTransformTranslate?

I move a view using CGAffineTransformTranslate, when I use NSlog: view.center.x, this value is not changes when I move? But I NSlog: view.frame.orgin.x, this current value always changes when I move! So, how to get current value center when I move?
Huỳnh Phong
  • 31
  • 1
  • 6
0
votes
2 answers

Why rotating imageView, it changes position?

when I use: ImageView.transform = CGAffineTransformRotate(ImageView.transform, rotation); everytime I rotate imageView and I NSLog(@"x:%f y:%f", ImageView.frame.orgin.x, ImageView.frame.orgin.y), x and y always change value?? Why?
Huỳnh Phong
  • 31
  • 1
  • 6
0
votes
1 answer

'Could no load image...' error when not referencing image?

The nslog gives the error "Could not load the "XXX.png" image referenced from a nib in the bundle with identifier "XXX". However, Image.png is never referenced in IB nor in my code. Why do I still get this error (I have also cleaned the product and…
JohnWickham
  • 571
  • 1
  • 6
  • 15
0
votes
2 answers

XCode - See console output after app exit, when running multiple app instances

When I run two apps from XCode debugger, I can see their own NSLog into the console. But when one app exist with an exit call, it is killed and I can't see the console log anymore. How may I do to be able to see it. In other words, i'm debugging the…
Oliver
  • 23,072
  • 33
  • 138
  • 230
0
votes
2 answers

Json Parsing issue with array of array in iphone?

I Have following Json as { "meta": { "code": 200 }, "response": { "deals": [ { "id": 32373, "date_added": "2011-01-13 12:12:50", "end_date": "2011-01-14 10:00:00", …
Ben10
  • 3,221
  • 2
  • 34
  • 61
0
votes
2 answers

NSLog returning null instead of string

NSLog is returning the output 'Null" instead of a string that I would have expected. I suspect that this is a problem with private instance variables and such, but since I am not familiar with Object-oriented programming I cannot determine the…
PappaSmalls
  • 349
  • 2
  • 13
0
votes
2 answers

Objective-C display array

I have created a NSMutableArray called myArray where I insert, using SQL statement, three variables. The one variable is a string and the other two double. Then in the viewDidLoad I want to display the array. Specificly I have used: -…
J-K
  • 139
  • 11
0
votes
3 answers

How to convert NData populated with hex values to NSString

I have a NSdata object that is populated with a bunch of information thats formated in hex.. I am trying to convert it into its proper string representation but am struggling to have any success. One thing I have tried is to simply put it into a…
HurkNburkS
  • 5,492
  • 19
  • 100
  • 183
0
votes
1 answer

Display an object using NSLog with octal format in objective-c

I would like to display a file's permissions in octal. The code below works but only shows the permissions in decimal. Any ideas how I can convert the result to octal? %o doesnt show the correct result. NSString *path=@"/somepath"; NSFileManager *fm…
user603749
  • 1,638
  • 2
  • 24
  • 36
0
votes
1 answer

Objective C: Display log in NSLabel or NSTextField

Is there a way to display the console log (where all the NSLogs are displayed) continuously in an NSLabel or a continuously scrolling NSTextField? There are important messages in the console I would like to print that are sent by the machine (not…
Zoltán Matók
  • 3,923
  • 2
  • 33
  • 64
0
votes
2 answers

NSMutableArray shows some hex content instead of actual values

Possible Duplicate: NSMutableArray Not showing actual values when NSLog in iphone application I have NSMutableArray initialised as follows: - (id)init { self = [super init]; if (self) { mySpotsArray = [[NSMutableArray alloc]init]; } return…
grep
  • 566
  • 5
  • 20
0
votes
1 answer

NSString encoding issue

I have xml string. It's wrong string. But after using NSLog and coping it from console, it became good string (I got good response from server). I build wrong string by this way: NSString *soapMessage = [NSString stringWithFormat:@"
Paul T.
  • 4,938
  • 7
  • 45
  • 93
0
votes
1 answer

Is it possible to NSLog only the string that I pass, not the other info?

NSLog(@"example"); will ouput : 2012-09-13 04:54:48.128 MyApp[94652:a0f]: example on the console. Is there a way I can get it to only output: example
Norton Commander
  • 653
  • 1
  • 10
  • 21
0
votes
2 answers

Xcode write NSLog result in UILabel

I use NSLog(@"%@"); And the NSLog result is '23204239423' I don't explain you why ... it's just an example. I want the NSLog result appear in UILabel, is it possible ? I tried : Label.text = (@"%@"); , it doesn't work. Do you know how i can do it ?…
user1659987
  • 85
  • 3
  • 5