How detect who create the thread by crash log? - ios

When we receive some crash logs from Apple(TestFlight) which contain next some error:
Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
for example or etc.
And we can't reproduce it under debug. It just happens. And we have only crash logs.
How to detect initial caller background thread by crash log only?
If it’s possible.

Related

Retrieving HealthKit data on main thread is causing the app crash for random users - iOS - Swift

I'm using HealthKit on my app to read user's health data and show them the data in the appropriate place on my app. For some production users(Major impact is on an iPhone X user), It's getting crashed while retrieving the health data using HealthKit(on Main Thread). But I'm not able to reproduce it.
Here is my code where I start taking the user permissions and read the health data.
Here is the crash information from fabric.
As per the crash info, it crashed while reading the DOB from HealthKit and I believe that there is no issue in getting DOB and I think the crash is happening because I'm reading health data on Main Thread and it might encounter with some multithreading issues. Tried with multiple devices, and I'm not able to reproduce the issue.
1) Any points on why reading the data from HealthKit on Main Thread is causing the crash?
2) Is the completion block I'm running on Main Thread expired/deallocated and might cause the crash?
Thanks.

0x8badf00d Crash after listening location on background fetch

In my ios app, I start listening user's location updates in the background for a while (up to 15 mins) when I receive background fetch execution. However, after I stop updates, the app crashes with the 0x8badf00d error.
I've enabled background location and background fetch permissions, and I also have enabled background location updates on CLLocationManager.
Any idea on why this error happens?
The problem isn’t that it isn’t running in the background, but rather whatever was running was blocking the main thread.
The 0x8badf00d (“ate bad food”; lol) indicates that the watchdog process (that monitors for dead/blocked processes) killed your app, generally because you did something to block the main thread. If you avoid blocking the main thread, this error should go away. See Technical Note 2151: Understanding and Analyzing Application Crash Reports and search for 0x8badf00d.
As it says:
The exception code 0x8badf00d indicates that an application has been terminated by iOS because a watchdog timeout occurred. The application took too long to launch, terminate, or respond to system events. One common cause of this is doing synchronous networking on the main thread. Whatever operation is on Thread 0 needs to be moved to a background thread, or processed differently, so that it does not block the main thread.
They’re focusing on synchronous network requests, but it can be anything that blocked the main thread for too long, whether a slow synchronous process or a deadlock or whatever. You should look at the stack trace for thread 0 and see if you can identify what blocked the main thread. There’s not enough here for us to diagnose it, though.
Common culprits include synchronous network calls, synchronous GCD calls, inappropriate use of semaphores, locks, or dispatch group “wait” calls, deadlocks, etc.

Identify when the app crashes

Likewise that have functions in Objective-C to know when the screen will Appear, or When the User exit the app, or receive memory warning, I believe there is a way to know when the device will give crash.
If this function exists, I could create an alert will notify the user that the application has an error and the logs would be sent to my email, I wonder if this Possibility exists?.
Grateful.
like every POSIX process, iOS apps receive signals when they're crashing. thats how test flight works.
a) for exceptions use the function NSSetUncaughtExceptionHandler
b) for a signal handler (other crashes then exception) use signal
I won't write all the code here but for further info Ill refer to:
http://www.cocoawithlove.com/2010/05/handling-unhandled-exceptions-and.html
BUT
I would just try to avoid crashing because a handler often isn't really useful and it can very well be tricky to implement a signal handler because everything CAN be in a corrupt state. For example it may well corrupt your CoreData database or user defaults.
Don't ship it I'd say :)

MTAudioProcessingTap kills mediaserverd at breakpoints

When using AVPlayer with MTAudioProcessingTap, stopping at a breakpoint anywhere in the application, on any thread, will cause mediaserverd to die temporarily.
This can be observed by setting a breakpoint anywhere in Apple's sample app. [AudioTapProcessor]
https://developer.apple.com/library/ios/samplecode/AudioTapProcessor/Introduction/Intro.html
For example, you can set it in the updateCenterFrequencySliderValue: method in MYSettingsViewController.m. (I also have an even smaller sample app I can post if it's helpful.)
This error message usually only appears in the device's Console log (viewable in Organizer), but sometimes also appears in the app's debugger log:
<Error>: 17:48:04.833 ERROR: [0x28c0000] 75: AudioQueueProcessingTapGetSourceAudio posting message to kill mediaserverd (45)
Playback usually resumes several seconds after continuing past the breakpoint. The AVAudioSessionMediaServicesWereResetNotification is not posted.
Is this expected behavior, or does it indicate a problem? Is there any way to avoid it? If you are using MTAudioProcessingTap and regularly encounter this, has it been an issue for your development or debugging process?
(I'd also be interested in any feedback on whether MTAudioProcessingTap is ready for primetime generally, since it's a relatively new and lightly documented component.)
Thanks in advance!

Received signal SIGSTOP on saving to iCloud

When I save a single datum to the iCloud, it works fine and when I need to save number of data to iCloud, I put the same code steps to save inside the for loop.
When I tried saving number of data to iCloud, the following signal is received and the app is hanging infinitely. The signal received area is in the below image.
and the crash area points at
How I can debug this crash? Can someone help me with explantion ASAP
The documentation for that method says, "Important: Do not call this method from your app’s main thread." The warning goes on to say that doing so may cause a deadlock. It sounds as if that's the condition you have.

Resources