nslog

What are the numbers in the square brackets in NSLog() output?

扶醉桌前 提交于 2019-12-17 10:53:33
问题 What is the stuff between the [] in the log message below? I get this in my iPhone app, and I have no idea where the message is coming from. My first guess would be a line number, but which file would it be in? 2010-10-19 08:56:12.006 Encore[376:6907] 回答1: The first number is the process ID, the second is the logging thread's Mach port. A desktop example: 2010-10-19 17:37:13.189 nc_init[28617:a0f] nc <CFNotificationCenter 0x10010d170 [0x7fff70d96f20]> - default <CFNotificationCenter

Do I need to disable NSLog before release Application?

痴心易碎 提交于 2019-12-17 02:17:23
问题 When releasing an app for iPhone, if I disable NSLog(); will it perform better? 回答1: One way to do it is to go into your Build settings and under the Debug configuration add a value to "Preprocessor Macros" value like: DEBUG_MODE=1 Make sure you only do this for the Debug configuration and not for Beta or Release versions. Then in a common header file you can do something like: #ifdef DEBUG_MODE #define DLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__]

Xcode how to NSLog a JSON

≯℡__Kan透↙ 提交于 2019-12-13 04:33:45
问题 Is there any way to get NSLog to print out an entire JSON file. I am currently saying NSString *deviceInfo = [NSString stringWithFormat:@"%@ %@", [[UIDevice currentDevice]model], [[UIDevice currentDevice]systemVersion]]; NSDictionary *json = [deviceInfo JSONValue]; NSLog(@"json file = %@", json); And it is printing out "json file = (null)" Thanks Clinton 回答1: I think you’re misunderstanding what JSON is for. The string you’re passing to -JSONValue isn’t a valid JSON string, so it’s returning

Xcode write NSLog result in UILabel

☆樱花仙子☆ 提交于 2019-12-12 04:34:08
问题 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 ? Thanks. 回答1: NSLog usually takes a string like: NSLog(@"%@", string); So instead just do this: label.text = [NSString stringWithFormat:@"%@", string]; 回答2: You have to put a variable NSString *text = @"My Text"; label.text = text; Or label.text = @

Why rotating imageView, it changes position?

会有一股神秘感。 提交于 2019-12-12 04:34:03
问题 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? 回答1: Well the .frame.origin is the top left corner of you UIImageView and since you are rotating it the top left corner is moving. If you access the .center it should stay the same. 回答2: The UIView documentation states that Warning: If this property is not the

Swift stderr and stout into single file

强颜欢笑 提交于 2019-12-12 04:23:04
问题 For an iPhone app, I need to collect debugging data into a file to be sent to an online service for analysis. This works fine by diverting the stderr output to a file handle and sending the file when appropriate. ( NSLog output also ends up in stderr , so this works across the board.) The same method also works fine with stdout . Here is how I do the saving to a file: freopen(cStringFilePath, "a+", stderr) // or stdout The above correctly returns a UnsafeMutablePointer<FILE> which I keep

Where do the NSLogs show up in xcode 6

妖精的绣舞 提交于 2019-12-12 02:51:48
问题 I have a project in Xcode with a ton of NSLogs, that have always worked... in Xcode 5. I updated to Xcode 6 and my app doesn't want to log anything. I have the debug area up and both sides are showing, I've tried pushing all the buttons down there and it still doesn't show up. It's really frustrating because I need the NSLogs so I can debug my app. 来源: https://stackoverflow.com/questions/26079914/where-do-the-nslogs-show-up-in-xcode-6

NSLog statements not showing for iOS 10 in apple Configurator

懵懂的女人 提交于 2019-12-11 23:49:39
问题 I have an app built using XCode 7.3 and it works fine with iOS 10. But, the NSLog() statements that I had used for debugging earlier aren't showing up. I could see them earlier inside apple configurator and now all I can see are so many kernel process messages. The same is still working when I test an iOS 9.x device. Kindly, update if this is resolved or is there any workaround. 回答1: If you have use XCode 8 then solution is below... Goto -> Product -> Scheme -> Edit Scheme -> Run -> Arguments

Debug Breakpoints - Display variable values in Log Message

这一生的挚爱 提交于 2019-12-11 20:07:20
问题 When I use the Log Message as Action in a Breakpoint is it still possible to print current variable values to the log output ? When using a NSLog inline something like this is possible ... NSlog(@"<DeleteArea> <State> CallToggle %i",[[deleteCardState userInfo] intValue]); however in a breakpoint as Log Message using e.g. ... @"<DeleteArea> <State> CallToggle %i",[[deleteCardState userInfo] intValue] does not work. How do you output formatted variables in breakpoints? 回答1: You can do it as a

iOS NSLog %hd %hhd %ld and %lld format specifiers [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-11 12:15:13
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What would be the meaning of these format specifiers? %hd %hhd %ld %lld 回答1: %hd is used for short integer or unsigned short integer %hhd is for short short integer or unsigned short short integer %ld is for long integer or unsigned long integer %lld is for long long integer or unsigned long long integer Simple