Post not yet marked as solved
Xcode 13.1 (13A1030d)
14" MacBook Pro (M1Pro 10/16 cores)
iPhone 13 Pro Max 512GB
I'm having an issue with running projects on a physical device. Xcode gets stuck on "Making the device ready for development" when trying to run a physical device. In Devices and Simulators, I see a variety of errors:
"Could not locate the device support files - Xcode could not determine the device type"
"Failed to cache symbols for watch (null) connected to Travis's iPhone - Unknown reason. If you are using a supported combination of hardware, please reboot and unlock all devices (including the host Mac) and respond to any outstanding pairing requests"
There are no outstanding pairing requests. I have un-trusted and re-trusted my MBP from my iPhone and Apple Watch, and have unpaired & repaired my Apple Watch to my iPhone. I have completely shut down and rebooted all devices (iPhone, Mac, Apple Watch). I have connected & reconnected with 3 different lightning cables, 2 of which are brand new from Apple. I have cleared derived data for Xcode. Nothing fixes.
Usually after 4-5+ attempts of cancelling & re-running gets it to finally go through, but not always. Very annoying.
I'm using a UISplitViewController with a triple column style, with .displayMode set to .twoBesideSecondary in order to show all 3 columns. In landscape, there is plenty of room on iPad to display all 3 columns.
In portrait orientation, or when there's another app on screen in side-by-side multitasking, the screen is too narrow, and my 3rd column ("secondary" view controller) gets completely squished to a very narrow width. What I would like to do is switch the .displayMode property to .twoDisplaceSecondary in these cases so that the content in the secondary VC gets pushed off screen, rather than squished.
A great example of exactly what I want to do is the Contacts app on iPad. When in landscape, all 3 columns are fully shown. When an app is brought on screen for multitasking, it is detected somehow and the .displayMode changes to .twoDisplaceSecondary, and the 3rd column is pushed off screen rather than getting squished.
I think I know how to manage detecting orientation changes (using viewWillTransitiontoSize) so I can manage landscape vc. portrait displayMode, but I'm not sure how to detect when another app is present in multitasking.
Thanks!
I'm learning about setting up a new UISplitViewController in iOS/iPadOS 14. I have primary, supplementary, and secondary view controllers configured on the splitViewController using setViewController(for:) method. I'm using the primary view controller as a Sidebar, and have prefersLargeTitles set to true on it.
It seems like when I set up a UICollectionView in the Sidebar view controller, it causes the large title to go away. Configuring the collection view via frame (collectionView.frame = view.bounds), or via programmatic constraints doesn't seem to matter - the large title goes away either way.
Is this a bug, or is there something I'm doing wrong? Thanks!
Post not yet marked as solved
I'm getting a weird bug with an AVPlayerViewController presented to full screen from inline/embedded state. The bug is triggered when you begin to swipe to dismiss out of full screen, but then cancel the dismissal (i.e. try to keep the video full screen). The video tries to stay full screen but then just goes black, and the whole app becomes unresponsive while the audio still plays.I downloaded Apple's Using AVKit in iOS sample project after watching the Delivering Intuitive Media Playback with AVKitsession from WWDC19. In their sample project, they have an AVPlayerViewController embedded inline in a cell, and when the user taps the expand arrows, it goes full screen. While in full screen, the user can pan the video around in any direction without issue. Completing the pan/swipe gesture in a downward motion completes the dismissal and the view dismisses from full screen.In my project (Xcode 11.4) I'm embedding an AVPlayerViewController exactly how Apple does in their sample project, yet when I pan the video in full screen, the video goes black and the app has to be restarted (if I complete the swipe to dismiss gesture, it does dismiss correctly without issue, but you have to be very specific about it). Interestingly, I rebuilt my own code (below) inside Apple's demo Xcode project and everything works fine!The sample project says it's supposed to be exactly for the 2019 WWDC session and is compatible with Xcode 11+, however under "Project Format" in general settings the sample project says it's Xcode 9.3 compatible, and it doesn't have a SceneDelegate which was introduced with iOS 13.So in conclusion, could this be a bug with AVPlayerViewController and SceneDelegate? Or is there something I am missing?Here's the exact ViewController I'm using that works in Apple's sample project, but does NOT work in Xcode 11.4:class ViewController: UIViewController {
let videoContainer = UIView()
let padding: CGFloat = 20
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemGroupedBackground
title = "Video"
navigationController?.navigationBar.prefersLargeTitles = true
configure()
embedVideoInline(in: self, container: videoContainer)
}
private func configure() {
videoContainer.backgroundColor = .secondarySystemGroupedBackground
videoContainer.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(videoContainer)
NSLayoutConstraint.activate([
videoContainer.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: padding),
videoContainer.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: padding),
videoContainer.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -padding),
videoContainer.heightAnchor.constraint(equalToConstant: ((view.frame.width - padding*2)/16) * 9)
])
}
func embedVideoInline(in parent: UIViewController, container: UIView) {
let url: URL! = URL(string: "https://www.radiantmediaplayer.com/media/bbb-360p.mp4")
let playerItem = AVPlayerItem(url: url)
let playerViewController = AVPlayerViewController()
playerViewController.player = AVPlayer(playerItem: playerItem)
parent.addChild(playerViewController)
container.addSubview(playerViewController.view)
playerViewController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
playerViewController.view.centerXAnchor.constraint(equalTo: container.centerXAnchor),
playerViewController.view.centerYAnchor.constraint(equalTo: container.centerYAnchor),
playerViewController.view.widthAnchor.constraint(equalTo: container.widthAnchor),
playerViewController.view.heightAnchor.constraint(equalTo: container.heightAnchor)
])
playerViewController.didMove(toParent: parent)
}
}