Our iOS app has a subtle bug which is 100% reproducible on one of the team members’ device.
He is not a programmer, so he does not use XCode.
To investigate the bug, I plan to make a custom build with logging, ask him to launch it and reproduce the bug.
The question is where to write logs to and how to get them from his device with minimal friction.
I believe that logs must be written to some local file on iPhone, and then he send me this file say by email.
Are there any ideas how to make this sharing clear and easy for a non-programmer?
Little clarification:
In my concrete case I need to log a couple of (rather long) base64-encoded string.
The better way for your scenario is use slack, telegram or any chat application. Then instead log to the files, you can send log to a channel directly.
https://core.telegram.org/bots/api
https://api.slack.com/messaging/webhooks
In our applications, we write the log to the files, then server side supports the api to upload these files.
Looking at the changes introduced in 2016 to logging in iOS, I am wanting to locate the .logarchive file and attach it to an email programmatically in swift.
The following lead me to believe that this is not possible, but I was hoping someone out there has had some success.
Obtaining app logging
Release build debugging strategies
Unified Logging and Activity Tracing
These articles seem to suggest that the user needs to explicitly connect their device to a computer to access the logs. I am wanting to have the user simply tap a button in the app and be able to send us their console logs.
From iOS 15 OSLog can be read programmatically using OSLogStore. Unfortunately there is no system provided function to write it to a logarchive. For now you need to build the body with formatting of the file yourself.
I understand that there is an option for an iOS app user to share a crash report via Diagnostics & usage data. But I am faced with a problem where the app doesn't actually crash but looks like it's freezing on a particular screen and it doesn't happen for all users, only a few.
So is there an option for the affected user to share only the Console Output or for me to directly view the Console output through any means?
Also I am fairly certain that the app isn't freezing, rather it doesn't proceed after a screen due to Core Data model incompatibility issue. But I need to confirm if this is indeed the cause, hence the need for the user's Console output for this particular app.
Edit: To clarify, I have gone through quite a few posts on this topic but what I am looking for is an elegant and simple way for the app users to share the app's console output.
Let's say you have a app which uses passwords. During development, you want to troubleshoot some things, and use NSLog() to print out the password to see if it is working properly.
At a certain moment you are happy and everything is working.
You send your app to Apple and finally the app is accepted and submitted to the App store.
You forgot to remove the NSLog() which output the password....
Is there any way this can be bad? Or is there any way a hacker can listen to those NSLogs()?
Yes, this could be very bad, if your app crashes. Once users sync their device, the crash logs will make their way to their computer, along with the content of NSLog. This makes plaintext passwords available to anyone with a binary file reader.
For example, if Alice gives her phone to Bob, then Bob enters his password, completes his task, logs off, and gives Alice her phone back. Then your app crashes. Once Alice syncs her phone, she gains access to Bob's password.
Yes, this is bad. I have seen discussions in which attackers quickly asked about device console logs. Using the strings from those logs, they can quickly search the executable binary for similar strings, like the format string used for part of the log entry. Example:
NSLog(#"user entered password '%#'", passwordString)
Finding the format string, they can quickly find the part of code that actually uses that string, and thus they have found the part of code that processes passwords. They can then analyze the relevant code to bypass the password altogether or do whatever they want.
Even if the device does not hold a lot of console data for long, all an attacker might need to do is connect a stolen device to a computer, start the app and enter a random password. If the app logs the password (correct or incorrect), then the needed strings are still captured and the attack begins.
Of course, if the log line is still in the device console data, an attacker also gets the actual password for an actual user. And if that user reuses user names and passwords (as many people do) the attacker may now have the credentials to a user's other accounts on the internet, which may be more sensitive.
Many programming discussions advise against using NSLog directly and recommend using a macro like DEBUGLOG which will compile out of release builds. If that is used for debugging, then the app will not leave such clues for an attacker to use.
I guess . device log would contain that password !! this can be seen at xcode-window-device/device logs .
It depends on what kind of passwords your storing.
I believe that log files are stored on your iPhone. But I'm quite sure that reading these files without connecting the actual device to a computer is impossible.
Extra note: If I have to be honest, I wouldn't reject my app for reviewing at this moment. It's a good idea to prepare a patch and when your app is reviewed you should upload the new version as soon as possible. However if your saving passwords that connects the app to some sort of database, I would reject it.
OS: iOS-7
I'd like to automatically retrieve all the logs under "General->About->Diagnostics & Usage->Diagnostics & Usage Data" for administration purposes.
I know that you can use frameworks like PLCrashReporter or tools like crashlytics or testflight when you want to get crash logs automatically for your app. But this only works for apps that YOU develop, not for all the logs that are stored in the "Diagnostics & Usage Data".
I've found an App that might do what I want "iSyslog" (see it in the app store), but it says in the description "Logs cannot be retrieved under iOS7". Any of you knows if this is true?
Thank you.
You really are better off just connecting to a server with http request / JSon etc because you shouldn't send email without involving the user...