Hello everyone, I've encountered an issue with SwiftUI Preview and would appreciate your help.
Problem Description In a mixed Objective-C and Swift project, I'm experiencing the following situation with SwiftUI Preview:
Crashes when previewing on a physical device
The same code runs normally when launched directly through Xcode
Project uses CocoaPods for dependency management with static frameworks
Project Environment:
Project Type: Mixed (Objective-C + Swift)
Dependency Management: CocoaPods
Dependency Type: Static frameworks
Device: Physical device preview
Steps to Reproduce:
Write Preview code in SwiftUI file
Select physical device as Preview device
Click Preview button
Application crashes
QuickLook
RSS for tagCreate previews of files to use inside your app or perform simple edits on previews using QuickLook.
Posts under QuickLook tag
45 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
We found some Firebase crashes in QLPreviewController on iOS18.1 +.
It shows cash info in QLPreviewController that we haven't changed for some years.
Please help with this.
Thanks in advance.
// stack info from Firebase
Fatal Exception: NSInvalidArgumentException
*** -[NSURL URLByAppendingPathComponent:]: component, components, or pathExtension cannot be nil.
0
CoreFoundation
__exceptionPreprocess
1
libobjc.A.dylib
objc_exception_throw
2
Foundation
-[NSURL(NSURLPathUtilities) URLByAppendingPathComponent:]
3
QuickLookUICore
+[NSURL(_QL_Utilities) _QLTemporaryFileURLWithType:filename:]
4
QuickLookUICore
+[NSURL(_QL_Utilities) _QLTemporaryFileURLWithType:uuid:]
5
QuickLook
-[QLPreviewController(ScreenshotsSupport) screenshotService:generatePDFRepresentationWithCompletion:]
6
ScreenshotServices
__82+[SSScreenshotMetadataHarvester _grabPDFRepresentationForIdentifier:withCallback:]_block_invoke_3
7
libdispatch.dylib
_dispatch_call_block_and_release
8
libdispatch.dylib
_dispatch_client_callout
9
libdispatch.dylib
_dispatch_main_queue_drain
10
libdispatch.dylib
_dispatch_main_queue_callback_4CF
11
CoreFoundation
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
12
CoreFoundation
__CFRunLoopRun
13
CoreFoundation
CFRunLoopRunSpecific
14
GraphicsServices
GSEventRunModal
15
UIKitCore
-[UIApplication _run]
16
UIKitCore
UIApplicationMain
17
Glip
main.swift - Line 13
main + 13
I've developed a new Quicklook data-based preview extension for a custom file type that generates an image preview of the file. I previously used a Quick Look generator plug-in but support for it was deprecated and now removed in macOS Sequoia.
My app opens files using a
open(url.path, O_RDWR | O_NONBLOCK | O_EXLOCK)
call. The locking flags are used to prevent other clients from writing the file if it's already open.
I discovered that when Finder is showing the “large” file previews (such as when in column or gallery modes) from a SMB share, the open call fails with EWOULDBLOCK as if the file is locked.
It does work just fine on local files. Opening with O_SHLOCK also has the issue. Surprisingly it does work just fine for previews that return Plain Text data instead of Image data.
Using the lsof command, it seems like the Quicklook process has some kind of lock on the file.
This is the output of the lsof command:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE
QuickLook 48487 XXXX txt REG 1,15 125000611 3161369
Attached is a test project that tries a few different opening and locking functions. It also includes a test file and a sample image preview extension that displays a red square.
When everything is working, regular console messages show the progress of the tests. When the file is on a SMB share and selected in Finder Gallery mode, the open test will fail with a fault message in the console.
Notably, locking with flock works, which is weird because it should have similar semantics according to the man page for open(2).
Filed this as FB15051186
The app or its metadata appears to contain potentially misleading content. Specifically, the app includes content that resembles AlphaCargo without the necessary authorizatin.
I am creating an iOS app to install on legacy iPads running iOS 9 and up, using XCode 13.4.1 which is the latest version that will support iOS below 11. The app is working fine but I just added a QuickLook Preview extension, and on iOS 10.3.1 it will not install due to the following error:
This app contains an app extension that specifies an extension point identifier that is not supported on this version of iOS for the value of the NSExtensionPointIdentifier key in its Info.plist. Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653007
The NSExtensionPointIdentifier key in Info.plist is set by XCode automatically to "com.apple.quicklook.preview".
I want to set the iOS Deployment Target to the lowest iOS version that will support this configuration. The documentation does not provide any guide as to which specific NSExtensionPointIdentifier keys are compatible with which iOS version. It just says 8+ for the whole list. Trial-and-error is limited by availability of legacy Simulators.
If anyone can point to documentation that indicates which iOS is supported by which NSExtensionPointIdentifier key com.apple.quicklook.preview, I would be very grateful. Thanks
(I understand about lack of App Store support etc, this is an app for my use on old iPads)
I created a project using Reality Composer Pro. When I export to a .usdz file, it works well on iPhone 13, 14, 15, and 16 but not on iPhone 12 and 11.
In the timeline, I use a behaviour that is on added to scene to active intro animation and loop background audio. But it does not work on old device like iPhone 12 and 11. Also, all interactive taps/touch points/audio don't seem to work too.
Iphone 13,14,15,16 is on ios 18.1.
iPhone 11, 12 is on ios 17.6.1.
Here is sample usdz file exported from REality Composer Pro 2.0 that has problem above: https://drive.google.com/file/d/1sHZn9JABTswLq2flYjToTbWDuE5T7eNw/view?usp=sharing
I'm currently migrating a midsize (20k LOC) project to Swift structured concurrency. With complete checking turned on, it currently builds with only two warnings, both of which are related to the QLPreviewControllerDelegate protocol:
"Main actor-isolated instance method 'previewControllerDidDismiss' cannot be used to satisfy nonisolated protocol requirement; this is an error in the Swift 6 language mode" as well as the same warning but substituting 'previewController(_:transitionViewFor:)' for the method name.
I'm confused as to how to make these nonisolated, as they use UIKit classes/subclasses as arguments and/or return types.
I'm implementing a QuickLook extension through the macOS extension point com.apple.quicklook.preview using the view-based method where I implement QLPreviewingController to show information about the previewed file url.
This NSView controlled by my QLPreviewingController supports no interaction which makes sense, but I see some other QuickLook previews like for videos having toolbar button to open other apps or modify the content.
How can I get similar behaviour?
It appears that starting with macOS Sequoia, Quick Look Preview extension no longer loads MapKit maps correctly anymore. Map tiles do not appear, leaving users with a beige background.
Users report that polylines do render correctly, but annotations appears black.
This was previously working fine in prior macOS versions including Sonoma.
STEPS TO REPRODUCE
Create a macOS app project, with an associated document.
Ensure project has a Quick Look preview extension, with necessary basic setups.
Ensure that the extension mentioned in (2) must have a MKMapView. Any other cosmetic changes, etc, does not need to be implemented to observe the base issue. Do note that it has been reported that in addition to the map tiles not loading, annotations don't render correctly as well.
Hi,
I'm using NSPanel that his level is .popUpMenu and when I use .quickLookPreview in SwiftUI it make the the Quick Look behind the nspanel how can I fix it without change the level of NSPanel?
Below iOS, 18.0 its working properly but in iOS 18.0 facing issue
I can download pdf , I can see downloaded pdf in app sandbox container but unable to preview with app
We have a native iOS app that supports the upload and display of USDZ files. It has been working great since beta (late 2022) and live launch (late 2023) until now. But recently we had reports from some users on Max model phones (14 + 15 Pro Max) at least. When they launch tap and launch a 3D file the Quick Look player is triggered. So far so good. But for affected users the controls along the top of the player - X (close) AR | Object (toggle) and share button - are moving too high up the phone screen and getting stuck (untappable) behind the phone's top status bar (time, camera bug, connection, battery).
This means that when they open a USDZ file in AR or 3D view they have to hard-close the app to get out of it again. This doesn't happen when they open a USDZ file from Files, Dropbox etc on their phone (which also uses the Quick Look player). The controls only move up and get stuck when launching a USDZ from within our app.
I'm at a loss to figure out what might be causing this on some phones and not all others. And why only when opening a USDZ file from our app! So far we have replicated this issue on a single iphone 14 Pro Max and a 15Pro Max, both running iOS18+
We have tested on other 15Pro Max's on same OS, and Pros, normal iPhones, Minis and are not experiencing the issue. You would think that a USDZ file is a USDZ file and that your iPhone knows what to do with it and open it in the Quick Look player regardless of where you open the file from. Why would the navigation items be moving if you open the USDZ file from within our app, and why only for some select users?
We will continue to troubleshoot and test but I wanted to throw this out to the community in case anyone had experienced this or if anyone had any theories that would expedite our testing. Your thoughts are most appeciated!
Here is a video showing the expected (correct) behaviour: https://www.dropbox.com/scl/fi/0sp8s4opaf2m4gukkcbrk/How-opening-a-USDZ-should-behave_correct-behaviour.MP4?rlkey=tzzau9x91mwox66gsgguryhep&st=qiykmne9&dl=0 and a screenSHOT attached below of what is happening on one of the affected user's iPhone 15Pro Max.
I"m trying to create a simple app for my students that will display .heic images taken with a nikon and them converted to .heic in the photos app. My attempts only result in the QuickLook viewer showing the images in 2d. Any guidance? Here is my ContentView:
import SwiftUI
import QuickLook
struct ContentView: View {
@State private var showQuickLook = false
@State private var previewURL: URL? = nil // State to store the URL for Quick Look
var body: some View {
VStack {
Button("See it in 3D") {
// Set the URL for the file from the bundle and toggle Quick Look presentation
if let imageURL = Bundle.main.url(forResource: "Michelia_fuego", withExtension: "heic") {
previewURL = imageURL // Set the preview URL if the image is found
showQuickLook.toggle() // Toggle to trigger Quick Look presentation
} else {
print("File not found") // Print error if the file is missing
}
}
.quickLookPreview($previewURL) // Binding to the URL
}
}
}
#Preview {
ContentView()
}
Hi,
Following the wwdc24 video - What’s new in Quick Look for visionOS, I've managed to open a 3D model using PreviewApplication by calling
let previewItem = PreviewItem(url: modelURL, displayName: "Easter", editingMode: .disabled)
_ = PreviewApplication.open(items: [previewItem])
However, the "Save to Downloads" option is aways there(see attached screenshot). As the models are user generated content, and I don't want the download option to be available to all users. How to disable it?
I'm the developer of Camera RawX (avail on the Mac App Store).
I'm working on Camera RawX for iOS to provide Quick Look support for camera RAW files not supported by iOS.
I use the Files app to open a RAW file to invoke Quick Look on my iPad (it is running iOS 17.6.1).
The RAW file in question is a Fuji compressed RAF file.
When I tap on the RAF file, iOS opens the Quick Look window, but my app's Quick Look extension is not called.
If the RAW file in question is a Sigma Foveon X3F file, a file that has no native Apple RAW support, then my Quick Look extension is called and I'm able to display the image in the Quick Look window without issue.
It seems that a system recognized RAW file extension (RAF in this case), is not triggering my Quick Look extension. On the macOS, this works fine without any issue.
The strange thing is that my Thumbnail extension is being called when the RAW files show up in Files. Even if it is a RAF file. So it seems like a bug to me or am I missing something crucial in my Info.plist file?
Albert
In the company that I work we have a huge app and we have implemented an image annotation feature using the QLPreviewController but there is a bug where even with an OOTB implementation of the QLPreviewController, when I add a text, change the colour of that text and then double click on the text to edit it, it reverts back to black.
I tried the same implementation in a sample app but I couldn't reproduce the bug hence it is not a bug with the library but something with the app interacting with the library. I was wondering if anyone can provide any suggestion with what the reason may be, as sadly I cannot provide any code examples as that would break company code.
From my research what I found strange is that when I double click the coloured text and it goes to black, then undo it its as if that was not a recorded event as the undo goes back to the step before the text was coloured meaning it replaces the colour changing event rather than recording it as a new event that can be undone.
If any has any suggestion please help me as I am quite stuck. 🙏
Apple's own USDZ files from their website does not display properly both in OPReview and in Keynote when imported. It displays properly, however, in Reality Converter bit with this error:
"Invalid USD shader node in USD file
Shader nodes must have “id” as the implementationSource, with id values that begin with “Usd”. Also, shader inputs with connections must each have a single, valid connection source."
I tried importing other models from external sources and they work without any issue at all.
Is there any potential fix or workaround this?
Thanks in advance.
I'm experiencing an issue with QuickLook in iOS 18 where.reality files with audio playback are affected. When I open a.reality file that includes audio, the audio track plays twice: once from the moment the file is opened, and again from the start of the animation. This results in a duplicate audio playback.
I've tested this issue on multiple devices running iOS 16, 17, and 18, and the problem only occurs on iOS 18. I've tried restarting the devices and checking for any software updates, but the issue persists.
Steps to reproduce:
Open a.reality file with audio playback in QuickLook on an iOS 18 device.
Observe the audio playback.
Expected result:
The audio track should play only once, from the start of the animation.
Actual result:
The audio track plays twice, once from the moment the file is opened and again from the start of the animation.
Device and iOS version:
I've tested this issue on iPhone 12 Pro, iPhone 13 Pro running iOS 18, iPhone 13 running iOS 16 and iPhone 11 Pro running iOS 17,
QLPreviewView was used in the app to display the file previews. But the following crash was happening.
Date/Time: 2024-09-13 22:03:59.056 +0530
OS Version: Mac OS X 10.13.6 (17G14042)
Report Version: 12
Anonymous UUID: 7CA3750A-2BDD-3FFF-5940-E5EEAE2E55F5
Time Awake Since Boot: 4300 seconds
System Integrity Protection: disabled
Notes: Translocated Process
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: DYLD, [0x1] Library missing
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded: /System/Library/Frameworks/QuickLookUI.framework/Versions/A/QuickLookUI
Referenced from: /private/var/folders/*/Notebook (Beta).app/Contents/MacOS/Notebook (Beta)
Reason: image not found
Process: Notebook (Beta) [4365]
Path: /private/var/folders/*/Notebook (Beta).app/Contents/MacOS/Notebook (Beta)
Identifier: com.zoho.notebook.macbeta
Version: 5.5 (55008)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Notebook (Beta) [4365]
User ID: 501
Date/Time: 2024-09-13 22:03:59.056 +0530
OS Version: Mac OS X 10.13.6 (17G14042)
Report Version: 12
Anonymous UUID: 7CA3750A-2BDD-3FFF-5940-E5EEAE2E55F5
Time Awake Since Boot: 4300 seconds
System Integrity Protection: disabled
Notes: Translocated Process
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: DYLD, [0x1] Library missing
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded: /System/Library/Frameworks/QuickLookUI.framework/Versions/A/QuickLookUI
Referenced from: /private/var/folders/*/Notebook (Beta).app/Contents/MacOS/Notebook (Beta)
Reason: image not found