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

NSLog runs in main thread(?) blocks main thread when string is too big?

I need to send some left-over data to server when my app starts, so in applicationDidFinishLaunching I call a method which convert some Core Data entities to JSON text and send it to server. Sometimes the app crashes because: xxxxxx failed to…
hzxu
  • 5,753
  • 11
  • 60
  • 95
0
votes
1 answer

NSLog but show the raw unicode string

For example, it prints below string: "user_description" =…
flypig
  • 1,260
  • 1
  • 18
  • 23
0
votes
1 answer

Objective-C NSString: strange characters when logging

Hey all, I'm a total noob when it comes to Objective-C / iPhone development. I'm trying to pull in text from a SQLite DB. I have a while loop that looks like this: while(sqlite3_step(selectstmt) == SQLITE_ROW) { And within that loop, this prints to…
thekevinscott
  • 5,263
  • 10
  • 44
  • 57
0
votes
1 answer

NSJSON Loop Trouple

I am getting my data but it seems like the data is posting in NSLog everytime it finds my "is reservable"=1; I think this should only post once and when I display it in a tableview cell would it post more than once? Here is my NSLog: 2012-08-31…
TIDev
  • 109
  • 4
  • 10
0
votes
1 answer

Using NSlog with cross platform style

I am creating an iphone test using c++,and I want to use nslog( the only way to show debug information?) whenever I want to include nslog function my cpp has to change to mm right? is it the only way to do it? because I don't want to change back to…
user1051003
  • 1,211
  • 5
  • 16
  • 24
0
votes
2 answers

Newline in Objective C using Xcode 4.4

Has anyone had an issue besides me where /n didn't produce a new line in an output string? This is a starter program taken from "Programming in Objective C" Fourth Edition by Stephen Kochan. The code runs without error but prints /n instead of…
user1180395
  • 9
  • 1
  • 2
0
votes
1 answer

Instructions.m (instructions for the game) are not printing out the instructions?

I am creating an iphone application and for some reason, the instructions are not coming up when I run the code. This is my instructions class. When I run the program, nothing shows up. Shouldn't "The object of this game is" show up on the…
Surz
  • 984
  • 3
  • 11
  • 36
0
votes
1 answer

how to use login valid value select in database.the first value select login proprely but second value select login not proprely

- (BOOL)addloginprofile:(NSString *)username andPassword:(NSString *)password { //XYZAppDelegate *appDelegate = (XYZAppDelegate *)[UIApplication sharedApplication].delegate; //const char *sql = "select Name='%@',EnterPassword='%@' from…
jonty
  • 23
  • 4
0
votes
3 answers

Why isn't this print method working?

It works when I use NSLog, but not printf. I want to use printf because then all the elements in setA will be displayed in one line. #import #define INTOBJ(v) [NSNumber numberWithInteger: v] @interface NSSet (Printing)…
stumped
  • 3,235
  • 7
  • 43
  • 76
0
votes
1 answer

NSDictionary and plist

I have a plist file with string keys and number values. I think I managed to fill an NSDictionary object with the plist contents just fine with the code: NSBundle* bun = [NSBundle mainBundle]; NSString* path = [bun pathForResource:@"Tempos"…
425nesp
  • 6,936
  • 9
  • 50
  • 61
0
votes
1 answer

Different log level in source files with Lumberjack

I started using the Lumberjack logging framework. It requires an integer variable called ddLogLevel to be defined wherever I call one of the log macros. I could write static const int ddLogLevel = LOG_LEVEL_INFO at the top of every file to achieve…
DrummerB
  • 39,814
  • 12
  • 105
  • 142
0
votes
1 answer

Empty float ** for sound samples

I have been attempting to pass and array to a method within DiracLE audio library. The array looks like this in the debugger - (OSStatus) readFloatsConsecutive:(SInt64)numFrames intoArray:(float**)audio withOffset:(long)offset That fills the array…
user773578
  • 1,161
  • 2
  • 13
  • 24
0
votes
2 answers

iOS - How to view NSLog and printf output in ssh session on phone?

I have a simple iPhone App that uses an NSLog and several printf statements. The app is a simple test app that I created to test serial communication on the iPhone (3GS). Obviously I can not test serial com with the iOS Simulator, so I have my…
ipatch
  • 3,933
  • 8
  • 60
  • 99
0
votes
1 answer

How to print the retain count of an object?

I am trying to print out the retain count of an object in the terminal using NSLog. Here is my code: NSNumber *myInt=[[NSNumber alloc] initWithInteger: 100]; NSLog(@"myInt retain count=%d",[myInt retainCount]); The result should be 1 but what I…
God_of_Thunder
  • 753
  • 3
  • 20
  • 46
0
votes
3 answers

Index 0 beyond bounds [0 .. 0], but not an empty array

I have a UITableView for an app I am creating that will show Movie Trailers. In my RootViewController.h file I have this code (well all of the relevant code needed is supplied here): @interface RootViewController : UITableViewController { …
Encephalon
  • 153
  • 2
  • 12