Hello Apple Engineers,
Specific Issue:
I am working on a video recording feature in my SwiftUI app, and I am trying to record 4K60 video in ProRes Log format using the iPhone's internal storage. Here's what I have tried so far:
I am using AVCaptureSession with AVCaptureMovieFileOutput and configuring the session to support 4K resolution and ProRes codec.
The sessionPreset is set to .inputPriority, and the video device is configured with settings such as disabling HDR to prepare for Log.
However, when attempting to record 4K60 ProRes video, I get the error: "Capturing 4k60 with ProRes codec on this device is supported only on external storage device."
This error seems to imply that 4K60 ProRes recording is restricted to external storage devices. But I am trying to achieve this internally on devices such as the iPhone 15 Pro Max, which has native support for ProRes encoding.
Here are my questions:
Is it technically possible to record 4K60 ProRes Log video internally on supported iPhones (for example: iPhone 15 Pro Max)?
There are some 3rd apps (i.e. Blackmagic ππ») that can save 4K60 ProRes Log video on iPhone internally. If internal saving is supported, what additional configuration is needed for the AVCaptureSession or other technique to bypass this limitation?
If anyone has successfully saved 4K60 ProRes Log video on iPhone internal storage, your guidance would be highly appreciated.
Thank you for your help!
Post
Replies
Boosts
Views
Activity
Hi Apple Engineers,
I am encountering an issue where the memory usage reported by the Xcode memory report and the Xcode Instruments memory profiler are not aligned. Specifically:
Xcode Memory Report:
After implementing autoreleasepool, URLSession reading a zip file, and moving the task inside DispatchQueue.global().async, the memory usage goes down from 900MB to 450MB, indicating a potential memory leak.
Xcode Instruments Memory Profiler:
The memory usage goes down from 900MB to 100MB, suggesting that the memory has been properly released and there is no significant memory leak.
Could you please help me understand the discrepancy between these two tools and provide guidance on the appropriate way to interpret the memory usage in my application? Which result I should rely on it?
I would greatly appreciate your insights and expertise on this matter. Thank you in advance for your assistance.
In one of our SwiftUI projects, we intensively use UIViewController to present a SwiftUI View modally, and it works perfectly under normal circumstances.
However, we have observed that when screen mirroring is enabled on the iPhone, the @Environment viewControllerHolder becomes nil, preventing the proper presentation of another view. Xcode (14.5) does not flag any issues with the code, and our project is set to build for iOS 17.5.
Without changing too many codebase, is there a way to fix this unexpected issue?
import SwiftUI
import UIKit
struct ContentView: View {
@Environment(\.viewController) private var viewControllerHolder: UIViewController?
@State var presentSecondPage = false
var body: some View {
VStack(spacing: 40) {
Text("This is First Page")
Button("Present Second Page") {
presentSecondPage = true
}
}
.onChange(of: presentSecondPage) {
if presentSecondPage {
viewControllerHolder?.present(style: .fullScreen) {
SecondPage(presentSecondPage: $presentSecondPage)
}
}
}
}
}
struct SecondPage: View {
@Environment(\.viewController) private var viewControllerHolder: UIViewController?
@Binding var presentSecondPage: Bool
var body: some View {
VStack(spacing: 40) {
Text("This is Second Page")
Button("Back to First Page") {
presentSecondPage = false
viewControllerHolder?.dismiss(animated: true)
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.gray)
}
}
struct ViewControllerHolder {
weak var value: UIViewController?
}
struct ViewControllerKey: EnvironmentKey {
static var defaultValue: ViewControllerHolder {
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
let rootVC = windowScene?.windows.first(where: { $0.isKeyWindow })?.rootViewController
return ViewControllerHolder(value: rootVC)
}
}
extension EnvironmentValues {
var viewController: UIViewController? {
get { return self[ViewControllerKey.self].value }
set { self[ViewControllerKey.self].value = newValue }
}
}
extension UIViewController {
func present<Content: View>(style: UIModalPresentationStyle = .automatic, @ViewBuilder builder: () -> Content) {
let toPresent = UIHostingController(rootView: AnyView(EmptyView()))
toPresent.modalPresentationStyle = style
toPresent.rootView = AnyView(
builder()
.environment(\.viewController, toPresent)
)
NotificationCenter.default.addObserver(forName: Notification.Name(rawValue: "dismissModal"), object: nil, queue: nil) { [weak toPresent] _ in
toPresent?.dismiss(animated: true, completion: nil)
}
self.present(toPresent, animated: true, completion: nil)
}
}
Normal Circumstances
Screen Mirroring
Previously I reached out to Apple Support, regarding the purchase of additional code-level support quotas under my Apple Developer Program. Unfortunately, they were unable to provide an answer and directed me to contact the Code-Level Support team for further assistance. And Code-Level Support advised me to post questions on the Developer Forum.
Here I have two inquiries regarding Code-Level Support:
I understand that each Apple Developer Program subscription includes 2 Code-Level Support instances per year. How can we check our remaining support balance online?
If I exhaust my support quota, what is the procedure for purchasing additional support?
Thank you for any assistance.