I have an external accessory plugged in my iPad. I cannot see my NSLog statements because my ipad can no longer be connected to my computer. Is there a way to still see the NSLog statements?
Asked
Active
Viewed 420 times
2 Answers
3
Yes, you can redirect your NSLog statements to a file for later display. See Logging to a file on the iPhone.
This will cause log statements to be written to a named file. If you're wondering how it works, look up how C text input/output works, with stdin, stdout and stderr.
freopen([newFileName UTF8String], "w+", stderr);
You could just save that file to your Documents directory, and retrieve it through iTunes File Sharing. Or, you can have the app dump its log contents to the console once your device is plugged back in. Remember to disable that redirection first.
-
I placed the following code under application did finish launching function freopen([@"/tmp/my_logs.txt" fileSystemRepresentation], "w", stderr);. How do I make it dump to my console once I plug my iPad back into m computer? – user1120008 Apr 14 '12 at 14:59
-
You'll need to load that file `my_logs.txt` into a string. Then NSLog the log string without having redirected `stderr`. – Cowirrie Apr 14 '12 at 15:05
1
Do you have access to source code? If yes, then you can add some UITextView or UILabelView over all UIViews, and put all your NSLog statements there.

pawelropa
- 1,409
- 1
- 14
- 20