Hello.
In my app I have selection of photos and videos and also selection of PDF
So I use PHPickerViewController for picking photos and videos and
UIDocumentPickerViewController for picking documents.
I found out that there's not documentPickerWasCancelled in PHPickerViewController delegate. So when a user presses Cancel, delegate's picker function fires the dialog is dismissed and system return a selected value of nil. But when I swipe the dialog down no event is generated so in my app I can't understand whether a user selected a photo or cancelled the dialog.
In UIDocumentPickerViewController there's no such problems as it have didCancel as a separate funciton
Is there any way to bypass this this?
Photos & Camera
RSS for tagExplore technical aspects of capturing high-quality photos and videos, including exposure control, focus modes, and RAW capture options.
Post
Replies
Boosts
Views
Activity
Hello,
I am getting the following error while attempting to run my LockedCameraCapture compatible app on an iOS 15 device:
dyld[434]: Library not loaded: '/System/Library/Frameworks/LockedCameraCapture.framework/LockedCameraCapture'
Referenced from: '/private/var/containers/Bundle/Application/.../MyApp.app/MyApp.debug.dylib'
Reason: tried: '/System/Library/Frameworks/LockedCameraCapture.framework/LockedCameraCapture' (no such file)
Of course iOS 15 doesn't have the library for LockedCameraCapture, but I have had no issue including Lock Screen Widgets (which require iOS 16), so I am not sure why the error is popping up.
Thank you!
I am looking to learn more about the new Capture Button controls for iPhone 16, and am working to adapt the AVCam Sample Code to support the Capture Button. While I believe I've followed the guidance in the Enhancing your app experience with the Camera Control documentation, I'm finding that while my AVCaptureControl items seem to be added to the capture session, the Capture Button does not ever do anything, nor are any of the delegate methods called.
After I configure my capture session per the setupSession() method, I'm calling a method I added, func configureCameraControls(device:AVCaptureDevice):
func configureCameraControls(device: AVCaptureDevice) {
guard captureSession.supportsControls else {
assertionFailure("App does not support camera control.")
return
}
// Set the controls delegate
captureSession.setControlsDelegate(controlsDelegate, queue: sessionQueue)
// Begin configuring the capture session.
captureSession.beginConfiguration()
// Remove previously configured controls, if any.
for control in captureSession.controls {
captureSession.removeControl(control)
}
// Add a zoom control
let systemZoomSlider = AVCaptureSystemZoomSlider(device: device) { zoomFactor in
// TODO
}
// Create a control to adjust the device's exposure bias.
let systemBiasSlider = AVCaptureSystemExposureBiasSlider(device: device)
// Add a custom slider
let focusSlider = AVCaptureSlider("Focus", symbolName: "scope", in: 0...1)
focusSlider.setActionQueue(sessionQueue) { focusValue in
// TODO
}
// Iterate over the passed in controls.
for control in [systemZoomSlider, systemBiasSlider, focusSlider] {
// Add the control to the capture session if possible.
if captureSession.canAddControl(control) {
captureSession.addControl(control)
} else {
print("Unable to add control \(control).")
}
}
// Commit the capture session configuration.
captureSession.commitConfiguration()
}
I define the controls delegate like so:
final class CaptureControlsDelegate: NSObject, AVCaptureSessionControlsDelegate {
func sessionControlsDidBecomeActive(_ session: AVCaptureSession) {
}
func sessionControlsWillEnterFullscreenAppearance(_ session: AVCaptureSession) {
}
func sessionControlsWillExitFullscreenAppearance(_ session: AVCaptureSession) {
}
func sessionControlsDidBecomeInactive(_ session: AVCaptureSession) {
}
}
Which I instantiate earlier on in my app's lifecycle and make available to the CaptureService actor.
I'm not sure if this snippet can provide enough detail to gather some help, but I can't quite fathom why the camera/capture pipeline works, but I'm not getting any functionality from the Capture Button nor is the AVCaptureSessionControlsDelegate ever having its methods called.
After updating to 18.1 beta 5, the spatial video option no longer exists in settings, and the icon for capturing spatial video also disappears in camera app.
Device model, iPhone 15 Pro
I am working on an image processing app that requires 8 bit per channel (bpc) images.
Sometimes, input images are 16 bpc (e.g. sRGB IEC61966-2.1; extended range)
The app already draws the input image in a CGContext producing an 8 bpc CGImage. This works fine if the input is 16 bpc and I get an 8 bpc image.
I am wondering if it would be better for image quality to convert the 16 bpc images to 8 bpc using Accelerate before that CGContext draw? or does that draw essentially do the equivalent?
Hello,
I have followed the Creating a camera experience for the Lock Screen guide, and can now launch my app using the iPhone 16's new camera button.
That said, after about 10 seconds the app is force-closed by the OS, with the only message appearing in the console: "Terminated due to signal 9".
This error does not happen when:
launching the app via physical camera button when device is locked
launching the app by tapping the icon on the Home Screen
It is only happening when:
launching the app via physical camera button from the Home Screen when device is unlocked
Any ideas?
Thank you!
Dear Apple Support,
I’ve noticed an issue with the Messages app on iOS 18. When I try to send Live Photos, I select the Live Photo icon, but the photo is sent as a still image instead. Despite following the correct steps, the Live Photo feature doesn’t seem to be working properly.
I would appreciate it if your team could look into this and resolve the issue in an upcoming update.
Thank you for your support and continued innovation!
Best regards,
Erfan Nateghie
Hi all, we are working on iOS application that includes the camera functionality. This week we have received a few customer complaints regarding the camera usage with iPhone 16/16 Pro, both of the customers said that they have an issue with the camera preview(when the camera is open) the camera preview is just freezer but any other functionally and UI works as expected. Moreover the issue happens only for back camera, the front camera works perfectly.
We have tested it in context of iOS 18 with iPhone 14/15/15 Pro/15 Pro Max but all devices with iOS 18 works perfectly without any issues. So we assumed there was no issues with iOS 18 but some breaking changes with the new iPhone 16/16 pro cameras were introduced that caused this effect. Unfortunatly, currently we can't test directly usign the iPhone 16/16 Pro since we have't these devices.
We are using SwiftUI framework and here the implementation of the camera preview:
VideoPreviewLayer
final class CameraPreviewView: UIView {
var previewLayer: AVCaptureVideoPreviewLayer {
guard let layer = layer as? AVCaptureVideoPreviewLayer else {
fatalError("Layer expected is of type VideoPreviewLayer")
}
return layer
}
var session: AVCaptureSession? {
get { return previewLayer.session }
set { previewLayer.session = newValue }
}
override class var layerClass: AnyClass { AVCaptureVideoPreviewLayer.self }
}
UIKit -> SwiftUI
struct CameraRecordingView: UIViewRepresentable {
@ObservedObject var cameraManager: CameraManager
func makeUIView(context: Context) -> CameraPreviewView {
let previewView = CameraPreviewView()
previewView.session = cameraManager.session /// AVCaptureSession
previewView.previewLayer.videoGravity = .resizeAspectFill
return previewView
}
func updateUIView(_ uiView: CameraPreviewView, context: Context) {
}
}
Setup camera input
private func saveInput(input: AVCaptureDevice) {
/// Where input is AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)
do {
let cameraInput = try AVCaptureDeviceInput(device: input)
if session.canAddInput(cameraInput) {
session.addInput(cameraInput) /// session is AVCaptureSession
} else {
sendError(error: .cannotAddInput)
status = .failed
}
} catch {
if error.nsError.code == -11852 {
sendError(error: .microphoneError)
} else {
sendError(error: .createCaptureInput(error))
}
status = .failed
}
}
Does anybody have similar issues with iPhone 16/16 Pro? We would appreciate any ideas of how to potentially resolve the issue.
Does anyone else’s came not work properly I can only do selfies since the update to iOS 18 as it’s blacked out the main camera
As you can see, the value shown in the AVCaptureSystemZoomSlider is not the same as the raw camera zoom factor.
I tried to calculate this value, and it seems it's 0.8. (5-1)*0.8=4.2-1 in this image.
It seems this factor only applies to the default wide-angle camera. And I can't get this value from anywhere. (It's not displayVideoZoomFactorMultiplier btw, I checked that.)
What is it?
Hello,
I am trying to get my camera app to launch from the Lock Screen, and see that calls to UIApplication.shared are not allowed. In my app, I have:
UIApplication.shared.isIdleTimerDisabled = true
Which is causing this compile time error:
'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead
I do not believe there is a view controller based solution for this. Is there a flag I can wrap around the call so that the compiler knows it won't be used during an application extension?
Thank you!
The system Camera app offers jpeg XL selection for ProRAW format. I found the "static let JPEGXL: AVVideoCodecType" in the documentation but how do you specify it for a 3rd party app?
Would it be a replacement for using the .availableRawPhotoPixelFormatTypes?
I've just received my iPhone 16 Pro to develop some of the Camera Control features.
I am trying to set up my app to be launched from a button press, and from my research in the documents this is only possible if I develop a LockedCameraCaptureExtension.
Is this correct? My app is written in React Native, so to build an extension would require me to re-create the entire UI in Swift which just isn't possible with my resources. Ideally I could build a simple extension that requires Authentication to open the app but I'n not sure that will work:
The app extension terminates shortly after launch if it doesn’t have an active camera view that uses AVCaptureEventInteraction to handle events from the hardware buttons, or if access to the camera hasn’t been requested.
This is a bit frustrating for something so simple as to just opening an app.
Thanks,
Alex
I have the AVCam sample working in Xcode 16, but I can not seem to find how to have is record ONLY in landscape mode. It seems to only run in portrait. Can someone give me a hint as to how to control this?
How can it be that you still don't have the option to move photos into an album instead of just copying them? This is a bad joke, right? The entire Photos app is absolutely untidy and a nightmare for people who like order. I want car photos in the car folder. Vacation photos in the vacation folder without them being visible in the recent folder. Cant be so difficult???
Hello,
I seem to be having an issue assigning my Capture Extension an icon. It works fine using a system icon, for example:
Image(systemName: "star")
But it fails when I use my custom icon, such as:
Image(uiImage: UIImage(named: "widget-icon")!)
The "widget-icon" is located in both my Assets collection and the widget folder for good measure, and yet, my Widget always has a "?" icon.
I am able to use "widget-icon" just fine for other Lock Screen widgets, but it is not working for the Camera Extension Widget.
Any thoughts?
Thank you for your help!
I’ve built a iOS camera app that applies many CIFilters to an image captured by the camera. Some of my users have reported that on occasion the images have large parts that are blank, see below:
Frustratingly, I can’t reproduce this myself! Does anyone know what could he causing it, is it a memory issue? I haven’t posted the code as there’s a lot to look over and I’m not sure it would help diagnose it.
Thanks for any pointers.
After upgrading to Xcode16RC, in an old project based on ObjC, I directly used the following controller code in AppDelegate:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
UIButton *b = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 44, 44)];
[b setTitle:@"title" forState:UIControlStateNormal];
[self.view addSubview:b];
[b addTarget:self action:@selector(onB:) forControlEvents:UIControlEventTouchUpInside];
}
- (IBAction)onB:(id)sender{
PHPickerConfiguration *config = [[PHPickerConfiguration alloc]initWithPhotoLibrary:PHPhotoLibrary.sharedPhotoLibrary];
config.preferredAssetRepresentationMode = PHPickerConfigurationAssetRepresentationModeCurrent;
config.selectionLimit = 1;
config.filter = nil;
PHPickerViewController *picker = [[PHPickerViewController alloc]initWithConfiguration:config];
picker.modalPresentationStyle = UIModalPresentationFullScreen;
picker.delegate = self;
[self presentViewController:picker animated:true completion:nil];
}
- (void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results{
}
Environment: Simulator iPhone 15 Pro (iOS18)
Before this version (iOS17.4), clicking the button to pop up the system photo picker interface was normal (the top boundary was within the SafeAreaGuide area), but now the top boundary of the interface aligns directly to the top of the window, and clicking the photo cell is unresponsive.
If I create a new Target, using the same codes, the photo picker page does not have the above problem.
Therefore, I suspect it may be due to the old project’s .proj file’s info.plist, buildSetting, or buildPhase lacking some default configuration key value required by the new version, (My project was built years ago may be from iOS13 or earlier ) but I cannot confirm the final cause.
iOS18.0 has the additional messages:
objc[79039]: Class UIAccessibilityLoaderWebShared is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_22A3351/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/AccessibilityBundles/WebCore.axbundle/WebCore (0x198028328) and /Library/Developer/CoreSimulator/Volumes/iOS_22A3351/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/AccessibilityBundles/WebKit.axbundle/WebKit (0x1980fc398). One of the two will be used. Which one is undefined.
AX Safe category class 'SLHighlightDisambiguationPillViewAccessibility' was not found!
Has anyone encountered the same issue as me?
When I set a custom exposure duration, like 1/8, and then switch back to continuous auto exposure, the exposure duration in areas that were previously 1/17 changes to something like 1/5 or 1/10. As a result, the screen becomes laggy and overexposed. I'm not sure why this is happening.
We are trying to build a simple image capture app using AVFoundation and AVCaptureDevice.
Custom settings are used for exposure point and bias.
But when image is captured using front camera , the image captured from the app and front native camera does not match.
The image captured from the app includes more area than the native app.
Also there is difference between the tilt angle between two images.
So is there any way to capture image exactly same as native camera using AVFoundation and AVCaptureDevice.
Native
Custom