Reputation: 161
We have crash in AVFoundation.
AVFoundation +[AVOutputContext(FigRoutingContext) currentRoutingContextFactory]
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000a3c27beb8
Crashed: Thread
0 libobjc.A.dylib 0x183b8c910 objc_msgSend + 16
1 AVFoundation 0x18a5401bc +[AVOutputContext(FigRoutingContext) currentRoutingContextFactory] + 56
2 AVFoundation 0x18a53ae28 +[AVFigRoutingContextOutputContextImpl sharedAudioPresentationOutputContext] + 28
3 AVFoundation 0x18a4d0a24 +[AVOutputContext sharedAudioPresentationOutputContext] + 40
4 MediaPlayer 0x195deb1cc -[MPAVLightweightRoutingController pickedRoutes] + 68
5 MediaPlayer 0x195e04338 -[MPVolumeView _setShowsVolumeSlider:] + 96
6 MediaPlayer 0x195e02ad4 -[MPVolumeView layoutSubviews] + 208
7 UIKit 0x18e593770 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1420
8 QuartzCore 0x188b3525c -[CALayer layoutSublayers] + 184
9 QuartzCore 0x188b393ec CA::Layer::layout_if_needed(CA::Transaction*) + 324
10 QuartzCore 0x188aa5aa0 CA::Context::commit_transaction(CA::Transaction*) + 320
11 QuartzCore 0x188acd5d0 CA::Transaction::commit() + 580
12 QuartzCore 0x188acdd10 CA::Transaction::release_thread(void*) + 244
13 libsystem_pthread.dylib 0x1845e457c _pthread_tsd_cleanup + 572
14 libsystem_pthread.dylib 0x1845e42cc _pthread_exit + 88
15 libsystem_pthread.dylib 0x1845e40d4 _pthread_wqthread + 1472
16 libsystem_pthread.dylib 0x1845e3b08 start_wqthread + 4
The Crashlytics wrote:
This crash has non-main threads that appear to use UIKit classes or functions. Generally speaking, it is only safe to use UIKit from the main thread. Calling into UIKit from background threads can cause unpredictable behavior (like crashes!). Please double check that all of your code (that is not on the main thread) has been explicitly marked as safe to use in the background by Apple.
But we don't use other threads in app.
Crashlytics logs:
Crashed: Thread 0 libobjc.A.dylib 0x184370910 objc_msgSend + 16 1 AVFoundation 0x18ad241bc +[AVOutputContext(FigRoutingContext) currentRoutingContextFactory] + 56 2 AVFoundation 0x18ad1ee28 +[AVFigRoutingContextOutputContextImpl sharedAudioPresentationOutputContext] + 28 3 AVFoundation
0x18acb4a24 +[AVOutputContext sharedAudioPresentationOutputContext] + 40 4 MediaPlayer 0x1965cf1cc -[MPAVLightweightRoutingController pickedRoutes] + 68 5 MediaPlayer 0x1965e8338 -[MPVolumeView _setShowsVolumeSlider:] + 96 6 MediaPlayer 0x1965e6ad4 -[MPVolumeView layoutSubviews] + 208 7 UIKit
0x18ed77770 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1420 8 QuartzCore 0x18931925c -[CALayer layoutSublayers] + 184 9 QuartzCore 0x18931d3ec CA::Layer::layout_if_needed(CA::Transaction*) + 324 10 QuartzCore
0x189289aa0 CA::Context::commit_transaction(CA::Transaction*) + 320 11 QuartzCore 0x1892b15d0 CA::Transaction::commit() + 580 12 QuartzCore 0x1892b1d10 CA::Transaction::release_thread(void*) + 244 13 libsystem_pthread.dylib 0x184dc857c _pthread_tsd_cleanup + 572 14 libsystem_pthread.dylib 0x184dc82cc _pthread_exit + 88 15 libsystem_pthread.dylib 0x184dc80d4 _pthread_wqthread + 1472 16 libsystem_pthread.dylib 0x184dc7b08 start_wqthread + 4
Init code:
self.volumeView = MPVolumeView.init(frame: CGRect.init(x: 0, y: 2,
width: 52.0,
height: 30.0))
self.volumeView?.showsVolumeSlider = false self.volumeView?.showsRouteButton = true
self.volumeView?.setRouteButtonImage(UIImage.init(named: "streaming_icon"), for: .normal)
self.volumeView?.setRouteButtonImage(UIImage.init(named: "selected_streaming_icon"), for: .selected)
self.volumeView.sizeToFit()
Please help resolve this issue.
Upvotes: 4
Views: 457
Reputation: 88
I have contacted Apple and they have verified my theory that MPVolumeView performs UI layout changes on a background thread.
Bug report created.
Update 2018-05-30: Engineering has determined that your bug report (40594280) is a duplicate of 39309134 and will be closed.
Upvotes: 1
Reputation: 367
I have the same crash condition using MPVolumeView and AVPlayer. With other weird things going on, like the volume slider disappearing.
The issues go away if I set the AVPlayer object attribute 'allowsExternalPlayback' to false.
player.allowsExternalPlayback = false
Seems strange but it worked.
Upvotes: 0