How to log an long long value with NSLog?
long long veryLong = // assume value here NSLog(@”My long long is: %lld”, veryLong); // now it’s right
long long veryLong = // assume value here NSLog(@”My long long is: %lld”, veryLong); // now it’s right
Use %d for int. And the parameters are pointers, so use * to access the values pointed to. NSLog(@”MSg:%d wParam:%u lParam:%d”,Msg,*wParam,*lParam);
Try this piece of code: NSString *digit = [[sender titlelabel] text]; NSLog(@”%@”, digit); The message means that you have incorrect syntax for using the digit variable. If you’re not sending it any message – you don’t need any brackets.
If you declare var myString: NSString? as an optional then you need to make sure it has a value before you pass it to the NSLog. So you could do it like this then NSLog(“%@” , myString!). If myString is nil and you put ! the program will crash and you will get fatal error: … Read more
There are 1024 bytes in a kilobyte and 1024 kilobytes in a megabyte, so… NSLog(@”File size is : %.2f MB”,(float)myData.length/1024.0f/1024.0f); Mind you, this is a simplistic approach that couldn’t really properly accommodate for byte sizes below 1,048,576 bytes or above 1,073,741,823 bytes. For a more complete solution that can handle varying file sizes, see: ObjC/Cocoa … Read more
.allHTTPHeaderFields returns a dictionary with the header content: NSLog(@”%@”, [request allHTTPHeaderFields]); // { // “Accept-Language” = “en;q=1”; // “Content-Length” = 190706; // “Content-Type” = “multipart/form-data; boundary=Boundary+D90A259975186725”; // “User-Agent” = “…”; // } Or for specific field: NSString *field = @”Content-Type”; NSLog(@”%@”,[request valueForHTTPHeaderField:field]); // multipart/form-data; boundary=Boundary+D90A259975186725
Since Xcode 6 the device manager pane has been split into its own window. (Window > Devices, or Command-Shift-2.) Once there, select your device, then show its log by clicking the disclosure triangle at the bottom of the window to the right of the sidebar.
You can use Apple Color Emoji to add some color to your Log output like this: if ([self isKindOfClass:[UITableViewController class]]) NSLog(@”💙 Table View controller Will appear: %@”, NSStringFromClass([self class])); else if ([self isKindOfClass:[UINavigationController class]]) NSLog(@”💜 Navigation controller Will appear: %@”, NSStringFromClass([self class])); else NSLog(@”💛 View controller Will appear: %@”, NSStringFromClass([self class])); Because the above code … Read more
Because print is not NSLog. It is as simple as that. NSLog is a logging tool in Foundation that writes to the Apple System Log facility which appears on the console. print(…) is a print function in the Swift Standard Library that writes to standard out, which appears on the console in debug sessions. You … Read more
Well, this is embarrassing. The console got deactivated somehow and I was actually watching the variables window. Pressing Shift +  + C did the trick. Many thanks to Robert King on this thread: https://devforums.apple.com/message/565880#565880