-[MPVolumeView initWithFrame:style:] block main thread

MediaPlayer -[MPVolumeView initWithFrame:style:] + 80 MediaPlayer -[MPVolumeView _initWithStyle:] + 124 MediaPlayer -[MPAVLightweightRoutingController initWithName:] + 140 AVFCore -[AVOutputDeviceDiscoverySession initWithDeviceFeatures:] + 84 I get an application Not Responding problem by capturing function call stack every runloop(1/60s frequency) and get same call stack at about 5 second.

MediaPlayer -[MPVolumeView initWithFrame:style:] + 80
MediaPlayer -[MPVolumeView _initWithStyle:] + 124
MediaPlayer -[MPAVLightweightRoutingController initWithName:] + 140
AVFCore -[AVOutputDeviceDiscoverySession initWithDeviceFeatures:] + 84
AVFCore -[AVFigRouteDiscovererOutputDeviceDiscoverySessionFactory outputDeviceDiscoverySessionOfClass:withDeviceFeatures:] + 216
AVFCore -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl initWithFigRouteDiscovererCreator:syncController:] + 156
AVFCore _AVFigRouteDiscovererFactoryCreateRouteDiscovererWithType + 132
AVFCore -[AVFigRemoteRouteDiscovererFactory createRouteDiscovererWithAllocator:options:] + 40
MediaExperience _FigRouteDiscovererXPCRemoteCreate + 912
CoreMedia _FigXPCRemoteClientSendSyncMessageCreatingReply + 40
libxpc.dylib _xpc_connection_send_message_with_reply_sync + 228
libdispatch.dylib _dispatch_mach_send_with_result_and_wait_for_reply + 60
libdispatch.dylib __dispatch_mach_send_and_wait_for_reply + 532
libsystem_kernel.dylib _mach_msg + 72
libsystem_kernel.dylib _mach_msg_trap + 8```

It seems that sync waiting for a xpc reply, I want to solve this by call `-[MPAVLightweightRoutingController initWithName:]` on a background thread, but it's call from `-[MPVolumeView initWithFrame:style:]`, I can not create UIView object from background thread. 

I have no idea about how to solve this.

Hello @oeljiangjiang. Please start by reading Diagnosing issues using crash reports and device logs, and the associated Topics.

similar promble,hope to get respone from apple

-[MPVolumeView initWithFrame:style:] block main thread
 
 
Q