Broadcast upload extension randomly fails, not starting and killing - ios

So the main idea is: my broadcast upload extension making video of phone screen and when it finishes it saves video into directory.
When I am starting extension it works well and saving video. It can make video during 30 minutes and longer. But for some reason it can be randomly killed after few seconds of work even few minutes without any error being displayed. I don't know what what is the problem?. Maybe somebody can help me with that?
It happens on iOS 13 and iOS 12.

Related

AVSampleDisplayBuffer hangs randomly after device reboot

Issue description
AVSampleBufferDisplayLayer seems to hang on iOS 12.3.1 (>= iOS 12.2 is also affected) after
reboot. It looks that after 5 minutes everything works fine again.
The issue is not reproducible on iOS 11.
In our production code we don't use AVAssetReader, so please ignore any issues
with it, if minor.
I can make application hang on AVSampleBufferDisplayLayer init, enqueue and
requestMediaDataWhenReadyOnQueue.
Please advise how we should implement AVSampleBufferDisplayLayer correctly
(examples are welcome). Especially when we have to maintain and exchange
many display layers at once.
How to reproduce the issue:
Clone repo: https://github.com/mackode/AVSampleBufferDisplayLayer_Hanging
Download:
Tears of Steel segment
Put tearsofsteel_4k.mov_1918x852_2000.mp4 in Resources/ directory
Open AVSampleBufferDisplayLayer_BlackScreen.xcodeproj
Take iOS 12.3.1 device and reboot it
Start debugging AVSampleBufferDisplayLayer_BlackScreen
The video should start playing, then move a slider (seek) one or a few more times
Sample code is available here:
https://github.com/mackode/AVSampleBufferDisplayLayer_Hanging
Observed result:
Video hangs usually on AVSampleBufferDisplayLayer methods
Expected result:
Video seeks and continues to play
Can someone help me with solving this mistery?

iOS 11/12 Core Audio - Crackling / Popping Audio

My configuration
iPhone X
iOS 12
Problem
Since iOS 11/12 my apps audio for some reason has a periodic crackling/popping sound which appears to get worse/more noticeable the louder or more constant the audio is.
Troubleshooting
I played a 800Hz sine wave from djay2 through AudioBus into my app and saved the output of my app to a file.
Loading my apps output into Audacity I can see that the crackling occurs every 14,112 samples or every 0.320 seconds.
Has anyone got any idea where I should start looking. Changing the internal configuration of my app between 41.1kHz and 48kHz appears to make no difference. I thought it might have been due to downsampling from the hardware sample rate.
Toggling Inter-App Audio Sync on/off within AudioBus appears to have some effect (1 in every ~8 toggles will stop the crackling).
I assume this is due to the AudioSession being restarted or something.
Has anyone got any idea what might be causing this or has experienced this before?
Thanks,
Anthony

App launching (and working) fine in Xcode but crashes in TestFlight and Ad-Ho

Here's a strange issue that I have never come across before. My app is fairly large one (~250MB) with heavy media contents – very image heavy. When testing and launching my app from Xcode to Simulator or iOS device (on both Xcode 6 and Xcode 7 Beta), the app works fine. It takes a few moments to load up, but once it does, everything works fine. And the most image heavy part of my application, which consists of about 50 thumbnails, loads just fine as well.
However, upon archiving the app and either uploading it to TestFlight or extracting as an Ad-Hoc IPA, the same thing happens: on the first initial launch of the app, it loads the launch screen for a few moments, and then crashes. Upon loading it a second time, the app will load up just fine, however that heavy party of my application (with the 50 thumbnails), some of the images will be missing.
Now at first, I didn't know what to make of it. However, upon the second and third versions, I noticed that, depending on how long it took to crash, the more thumbnails would show up. For example: if it loaded the launch screen for 30 seconds before crashing, it would show 22 of the 50 thumbnails. If it loaded for 45 seconds before crashing, it would show 26 of the thumbnails.
According to the exception code in your crash log, you "8 bad food". Your app is taking too long to initialize so it is getting killed by iOS. You'll need to move your app startup processing to background threads.
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.
from: TN2151

System bug in AVPlayer causes player's system wide to stop playing

Have little hope that anyone's encountered this, but there seems to be a system wide bug with AVPlayer. I've tested with my app along with other apps, including Pandora.
Namely, and randomly, if you successfully open the app and begin playing, then put the app in the background, perform a variety of random actions, such as playing media in other apps, making a phone call, etc, and try to come back to the app, the AVPlayer's don't play.
I've replicated this many times, though inconsistently, with Pandora and the app that I'm working on.
I've logged my code and have not found any errors in playback. It just doesn't play.
Has anyone else experienced this strange issue? I have spent countless days on it and am now desperate.
Looks like the AVFoundation media server is crashing and resetting, causing this problem.
The solution:
https://developer.apple.com/library/ios/qa/qa1749/_index.html

App audio no longer working after a few days in the background

My iOS app is an audio-led app. If I leave the app and leave multitasking on, I'm finding that if I return after a few days, it happily puts me back in the place in the app that I was, but all audio no longer works. There is no problem if I only leave it a few hours.
It has done this lots, and I have no idea how to reproduce it. I've solved the problem for now by turning multitasking off, which is obviously not ideal. However, this means that the audio gets a full reboot each time and doesn't render the app utterly useless!
Sorry for the vagueness, I'm a little stuck. Things I've tried: making sure all audio is released on transition of app to background, and allowing audio to run in the background (this does something else)
Ideas?
One solution, though not tackling the problem, would be to only allow the app to run in the background for a few hours - does anybody have an idea how to do this?

Resources