How can I obtain crash logs for Mobile Safari in the iOS Simulator? - ios

If Mobile Safari crashes in the iOS Simulator, where can the crash logs be found?
(Apple will want these attached to your bug reports.)

Look for files named MobileSafari_*.crash in ~/Library/Logs/DiagnosticReports/.
(Execute open ~/Library/Logs/DiagnosticReports/ in Terminal, then sort by date modified.)

Related

How to log in Objective C when iPhone is not attached to Xcode

I am using Xcode Version 13.4.1 (13F100) on a MacBook Pro with macOS Monterey 12.4 and programming in Objective-C.
I would like to log debug messages when my app is running on the iPhone device AND is NOT attached to Xcode. I tried OSLog like described here: https://www.avanderlee.com/debugging/oslog-unified-logging/
However when I open the Console App and select my connected iPhone after running the app the log is empty and I have to explicitly click on "Start streaming" only then I can see my log when I start the app again.
I would like to log when the iPhone is not connected and the app is running and then close the app and connect the iPhone and see the log from the app run. I don't want live streaming but look into past logs.
Is there a way to do that?
I wrote to Apple Developer Support and they said the following:
If you log in your code using OSLog, then you can retrieve those
messages using the Terminal command ‘log’ later on.
For example, with the device named “iPhone" connected to the Mac, you
can retrieve the log info from the last 3 minutes with:
> % sudo log collect --device-name iPhone --last 3m
You can then use Console to look through the saved logs, or you can
parse out the log data from the command line with the ‘log' command.
See its man page for usage.
Here a link on how to use OSLog:
https://www.avanderlee.com/debugging/oslog-unified-logging/
In Objective-C this worked for me:
#import <os/log.h>
os_log(OS_LOG_DEFAULT, "Some message");
I followed Apple Developer Support's advice and it worked for me.

How to find the place where the iOS code crashes using Firebase ? (when you can't reproduce the bug)

I'm using Firebase to get information about crashes of users of my application. Most of the crashes has no any useful information about code or place where it happens. All stack-trace and threads shows "Missing" text. Also I can't reproduce these crashes at my PC.
That crash is on Mac OS application, not iOS. My point of view is to look at that doc, (see "Build Your App With Symbol Information"). But may be on Mac OS apps that feature is not available.
https://developer.apple.com/documentation/xcode/building_your_app_to_include_debugging_information
What can I do to find the place it crashes ? See attached screenshot

HockeySDK Warning - How to test crash reporting?

I got this warning when running my application with HockeyApp integration:
[HockeySDK] WARNING: Detecting crashes is NOT enabled due to running the app with a debugger attached.
Crash reports are not sent and no alert is displayed when opening the app again.
Any one have any idea how to resolve this issue?
This has very simple reasons:
If you are running the app with Xcode attached, your app is connected to lldb, Xcode's debugger. When lldb is attached, it will of course do its job as a debugger and catch any exception or crash that occurs. This means that the crash can never reach the HockeyApp SDK or any other crash reporting SDK while lldb is attached at the same time.
The solution is also pretty simple. If you just want to make sure the SDK is integrated properly and will catch crashes, do the following:
Do a quick "Build & Run" to install the current version of the app on the simulator or device.
Click the "Stop" button in Xcode to stop the debugging session.
Manually start the app on the device or simulator by tapping or clicking the app icon.
Cause a crash.
Restart the app. Now the HockeySDK should process the crash report and show a dialog to approve crash log sending.
One thing to keep in mind: Make sure to not make the app crash immediately after app start as this would not give the SDK enough time to process and send the crash report before crashing again.
Hockey app sdk by default does not send report when a debugger is attached. There is nothing wrong with this.
It will send report when a archive build that release to ur tester cause a crash. I personally think this should and remain as this because you are trying to track crashes from your tester not when you are developing.

IOS App crashes, but there is no crash log available

I am starting my App from XCode and with a specific behaviour it just disconnects and the app disappears from my IPAD screens.
So I guess the app crashes.
Now my question. Where Do I get this crashlog ? I already looked into
Window -> Devices -> choose my Ipad -> "View Device Logs" . But I cant see any actual crash log. I have some from earlier times, but my actual doesn't show up.
How do I get a crashlog ?
check if you have enabled Share with app developers option in settings. Privacy -> Analytics -> Share with App Developers.Xcode was not showing crash logs, enabling this helped me
You need to look at the device console under windows, devices in Xcode.
Its possibly saying something about code signing, bundle id's or missing libraries.
Try to delete the crash logs from "earlier times".
You have maximum amount of saved crash logs, and if you passed it - you won't see the new crash logs

No device logs output after attaching iPhone to process in Xcode

I'm developing iOS apps with Xcode. So when I build through Xcode I get device logs shown in the console output. But when I disconnect the iPhone from USB, or detach the process, then plug in the phone again and try to attach the process (my app is running on the phone still), the console doesn't output anything anymore.
If I go to Window -> Devices and my iPhone it doesn't show any output in that console either. The console app doesn't show any output either. I've tried to kill Xcode, clean the project, but to no success.
Anyone know how to show output logs from the built app after the iPhone have been detached?
I solved the log output mystery. Since we're using Cocoa Lumberjack it "devoured" the normal NSLog output, I added another log output by writing this row:
DEBUG_LOGS([DDLog addLogger:[DDASLLogger sharedInstance] withLevel:DDLogLevelDebug]);
Where DDASLLogger is the apple console.

Resources