QuickLook

RSS for tag

Create previews of files to use inside your app or perform simple edits on previews using QuickLook.

QuickLook Documentation

Posts under QuickLook tag

42 Posts
Sort by:
Post not yet marked as solved
0 Replies
290 Views
With iOS 15 there are changes to keyboard handling. Besides usual overriding of keyCommands a programmer has to assign own commands higher priority than system commands. So, the following code works for me: final class MyViewController: UIViewController { override var keyCommands: [UIKeyCommand]? { let action = UIKeyCommand(input: UIKeyCommand.inputUpArrow, modifierFlags: [], action: #selector(myAction)) if #available(iOS 15, *) { action.wantsPriorityOverSystemBehavior = true } return [action] } // rest of the code } On the other hand, almost the same code but with inheriting from QLPreviewController doesn't work: final class PreviewViewController: QLPreviewController { // same internals as above } In view hierarchy I spotted that there is actually some kind of extra navigation, maybe that is stealing my keyboard presses, maybe that's why above code isn't working. Does anyone have an idea how to fix or workaround this issue? Obviously, the extra navigation is from Apple and I don't have access to these extra presented controllers. I was trying to print the following details, but neither helps: print(presentedViewController ?? "none") // output: none print(topMostViewController) // output: <MyApp.PreviewViewController: 0x7fbe44156203> print(inputViewController ?? "none") // output: none It's worth to add I've also tried to add method override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { print("test?") super.pressesBegan(presses, with: event) } And test never appears in the console, whatever button I press. So clearly something else steals the key presses. This did not happen before iOS 15. I conclude it, thinking it may be a bug in the API. Probably just no one thought of this scenario when adding the new keys..?
Post not yet marked as solved
5 Replies
783 Views
Has the problem of the black background when taking a picture with the AR Quick look function in iOS 15 been resolved? I think it's a rather serious bug. On an iOS 15 device, go to the Quick Look page below and display any of the multiple 3D models in AR Quick Look; the background will be black when you take a picture with the AR Quick Look shooting function. https://developer.apple.com/augmented-reality/quick-look/ There are similar events below, but they do not seem to be addressed at all. https://developer.apple.com/forums/thread/691784
Posted
by
Post not yet marked as solved
2 Replies
458 Views
Hi together, I am developing a document viewer for a specific API. I download the relevant files to a custom directory and open them using a QLPreviewController in SwiftUI. I built this with a UIViewControllerRepresentable. Everything is working fine except the saving of modified files using the pencil markup in the preview. Here is the error: https://pastebin.com/TRnfduE5 This is how my controller looks like: struct PreviewController: UIViewControllerRepresentable {     let url: URL     @Binding var isPresented: Bool          func makeUIViewController(context: Context) -> UINavigationController {         let controller = QLPreviewController()         controller.dataSource = context.coordinator         controller.navigationItem.leftBarButtonItem = UIBarButtonItem(                     barButtonSystemItem: .done, target: context.coordinator,                     action: #selector(context.coordinator.dismiss)                 )                  let navigationController = UINavigationController(rootViewController: controller)         return navigationController     }          func makeCoordinator() -> Coordinator {         return Coordinator(parent: self)     }          func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {             let controller = QLPreviewController()             controller.dataSource = context.coordinator         }          class Coordinator: QLPreviewControllerDataSource {                  let parent: PreviewController                  init(parent: PreviewController) {             self.parent = parent         }                  @objc func dismiss() {             parent.isPresented = false         }                  func numberOfPreviewItems(             in controller: QLPreviewController         ) -> Int {             return 1         }                  func previewController(             _ controller: QLPreviewController, previewItemAt index: Int         ) -> QLPreviewItem {             return parent.url as QLPreviewItem         }                  func previewController(_ controller: QLPreviewController, editingModeFor previewItem: QLPreviewItem         ) -> QLPreviewItemEditingMode {             .createCopy         }                  func previewController(_: QLPreviewController, didUpdateContentsOf: QLPreviewItem){             print("Updated.")         }                  func previewController(_: QLPreviewController, didSaveEditedCopyOf: QLPreviewItem, at: URL) {             print("Saved: " + at.path)         }              } } Does anyone know, what the problem is here? And I made another experience: as you see there, I'm currently only logging the output / actions - and there isn't anything being logged, if I made just one edit. It only throws the error above after the 1st edit - so if I edit sth again and tap done or the pencil icon again... Is this ok so? Thanks for any help or advise!
Posted
by
Post not yet marked as solved
0 Replies
247 Views
Hello, I am trying to use app groups to share preferences between an app and its QuickLook extension (both sandboxed), but I can't understand why it's not working. For testing, I created an empty macOS app project and added a QuickLook Extension, then on both the targets' entitlement files I added the app group domain in the form "teamid.test". Last but not least, in the Info.plist file of the QL extension i added some UTIs to have the QL extension called when previewing. In the QL extension's PreviewViewController.swift file I try to save a value like this: func preparePreviewOfFile(at url: URL, completionHandler handler: @escaping (Error?) -> Void) { let defaults=UserDefaults(suiteName: "teamid.***") defaults?.set(1, forKey: "test") handler(nil) } If I try to run the app and preview a file though, I get this message in the Console: Couldn't write values for keys ( test ) in CFPrefsPlistSource<0x7fb63681cce0> (Domain: teamid.***, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access And the value is not saved. The only way to make this work is to add a temporary exception in the extension target, like this: <array> <string>/Library/Group Containers/teamid.***/</string> </array> </plist> What bugs me is that if I try to save a value from the app instead, it works. Are app groups not supported for QuickLook extensions? Thank you, Michele
Posted
by
Post not yet marked as solved
7 Replies
1.1k Views
AR Quick View's AR Quick View button cannot be pressed on some iOS devices. As for the iPhone 12 Pro, the AR Quick View button cannot be pressed on iOS 15 when reading from the standard iOS QR code reader, but the AR Quick View button can be pressed on the iPhone 12 Pro with iOS 14. On other devices, you can press the AR Quick View button when launching from Safari, but you cannot press the AR Quick View button when accessing from the standard QR code reader. Also, on some iOS devices, the AR Quick View button cannot be pressed. The problem seems to be occurring outside of the https://konabeer.jp/beach-diorama-ar/ as well. Is there any way to avoid this AR Quick View button not being able to be pressed? It would be very helpful if I could get more information than just the solution to this problem. iPhone7(iOS13):OK iPhoneX(iOS15):QR Code Reader:NG iPhone11(iOS14):OK iPhone12Pro(iOS14):OK iPhone12Pro(iOS15):QR Code Reader:NG iPhone12(iOS15.1):QR Code Reader:NG iPad Air(iOS15):QR Code Reader:NG iPhoneSE(iOS15):QR Code Reader:NG As a result of our own verification, the AR Quick Look button is deactivated on iOS 15 and when the QR code is imported from the Control Center. If you know of any known bugs or workarounds, or if there are any informative sites that have information on this issue, I would appreciate it.
Posted
by
Post not yet marked as solved
1 Replies
535 Views
Hi, I'm trying to write a Quick Look extension for my iOS app. However, I'm having issues initializing AVAudioEngine in my QLPreviewingController subclass from preparePreviewOfFile. The following error messages are printed to the console after attempting to initialize AVAudioEngine, and the Quick Look Extension crashes with EXC_BAD_ACCESS. The same code works fine within the main iOS app. It also works on macOS inside a Catalyst app on the macOS Monterey RC when previewing a file in the Finder. I've also filed feedback with feedback number FB9713048. Thanks for taking a look at this. Console output: [audiocomp] AudioComponentPluginMgr.mm:545 reg server remote proxy error Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.audio.AudioComponentRegistrar was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.audio.AudioComponentRegistrar was invalidated: failed at lookup with error 159 - Sandbox restriction.} [as] AudioSessionClientManager.cpp:475 Couldn't connect to com.apple.audio.AudioSession Error: 1100; AudioSession will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] AURemoteIO is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: AURemoteIO returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] AURemoteIO is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: AURemoteIO returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] AURemoteIO is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: AURemoteIO returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] GetProperty is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: GetProperty returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] SetProperty is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: SetProperty returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] Initialize is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: Initialize returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:1123 failed: 268435459 (enable 2, outf< 2 ch, 0 Hz, Float32, deinterleaved> inf< 2 ch, 0 Hz, Float32, deinterleaved>) throwing -10878 throwing -10878 throwing -10878 throwing -10878 throwing -10878 throwing -10878 throwing -10878 throwing -10878 throwing -10878 [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] SetProperty is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: SetProperty returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] Initialize is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: Initialize returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:1123 failed: 268435459 (enable 2, outf< 2 ch, 44100 Hz, Float32, deinterleaved> inf< 2 ch, 0 Hz, Float32, deinterleaved>) [avae] AVAEInternal.h:109 [AVAudioEngineGraph.mm:1344:Initialize: (err = PerformCommand(*outputNode, kAUInitialize, NULL, 0)): error 268435459 [avae] AVAudioEngine.mm:167 Engine@0x2830594d0: could not initialize, error = 268435459 [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] SetProperty is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: SetProperty returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] Initialize is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: Initialize returned server mach error 0x10000003! [aurioc] AURemoteIO.cpp:1123 failed: 268435459 (enable 2, outf< 2 ch, 44100 Hz, Float32, deinterleaved> inf< 2 ch, 0 Hz, Float32, deinterleaved>) [avae] AVAEInternal.h:109 [AVAudioEngineGraph.mm:1344:Initialize: (err = PerformCommand(*outputNode, kAUInitialize, NULL, 0)): error 268435459 [avae] AVAudioEngineGraph.mm:4631 Can't retrieve source node to play sequence because there is no output node! [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [aurioc] AURemoteIO.cpp:148 Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable [default] GetProperty is passing a serverPID of 0 to CheckRPCError! [default] CheckRPCError: GetProperty returned server mach error 0x10000003! (lldb)
Posted
by
Post not yet marked as solved
0 Replies
550 Views
Hi I am trying to display a USDZ model in my app using code similar to that described here: https://developer.apple.com/documentation/arkit/previewing_a_model_with_ar_quick_look however, after updating to iOS 15 and Xcode 13 the option to toggle between the base model view and the AR view is no longer there, the share button is also missing. I am using view inside a navigation view in SwiftUI with code as follows. import SwiftUI struct ModelView: View {   var body: some View {     ARQuickLookView()   } } struct ModelView_Previews: PreviewProvider {   static var previews: some View {     ModelView()   } } import SwiftUI import QuickLook import ARKit struct ARQuickLookView: UIViewControllerRepresentable {   var allowScaling: Bool = true       func makeCoordinator() -> ARQuickLookView.Coordinator {     Coordinator(self)   }       func makeUIViewController(context: Context) -> QLPreviewController {     let controller = QLPreviewController()     controller.dataSource = context.coordinator     return controller   }       func updateUIViewController(_ controller: QLPreviewController,                 context: Context) {     // nothing to do here   }       class Coordinator: NSObject, QLPreviewControllerDataSource {     let parent: ARQuickLookView           init(_ parent: ARQuickLookView) {       self.parent = parent       super.init()     }           func numberOfPreviewItems(in controller: QLPreviewController) -> Int {       return 1     }           func previewController(      _ controller: QLPreviewController,      previewItemAt index: Int) -> QLPreviewItem {       let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("model.usdz")       return url as QLPreviewItem     }         } } struct ARQuickLookView_Previews: PreviewProvider {   static var previews: some View {     ARQuickLookView()   } } Any info on why I don't have these options and how I could get them back would be appreciated. Thanks Louis
Posted
by
Post not yet marked as solved
1 Replies
387 Views
I'd like to add a QuickLook Preview Extension to my Mac app (AppKit), however I don't see a template for the extension in Xcode 13 under macOS (though there is a templete for iOS). This seems to be a change as there was an extension template for Mac offered in Xcode 12. Is this simply an oversight, or are Quick Look Preview Extensions no longer a thing on the Mac?
Posted
by
Post not yet marked as solved
2 Replies
587 Views
Will AR Quick Look support be provided via in-app browsers on iOS 15? The most recent update of iOS 15 doesn't provide this functionality. The user sees a greyed out AR button. The Object mode works as expected, however. To replicate: Send this link (https://www.apple.com/events) to the Gmail app, or message it to yourself in Slack or Discord Open it Tap on the Apple logo
Posted
by
Post marked as solved
2 Replies
531 Views
Hi all, this is my first time trying to add an AR preview into an app (also my first time using the file system). I have been trying to implement a solution similar to that explained here https://developer.apple.com/forums/thread/126377 however one key difference is that my usdz model is not in my main bundle as it is generated and downloaded from an external source at run time. I was wondering if it is possible to display a file stored in the apps documents or cache directory and how it is done. The file is downloaded and stored in the caches directory as follows: class ModelFetcher: NSObject{   var modelUrl: URL?       func generateModel() {     guard let url = URL(string: "http://127.0.0.1:5000/model.usdz") else {return}     let urlSession = URLSession(configuration: .default, delegate: self, delegateQueue: OperationQueue())     var request = URLRequest(url: url)     request.httpMethod = "POST"     let downloadTask = urlSession.downloadTask(with: request)     downloadTask.resume()   } } extension ModelFetcher: URLSessionDownloadDelegate {   func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {     print("File Downloaded Location- ", location)           guard let url = downloadTask.originalRequest?.url else {       return     }     let docsPath = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]     let destinationPath = docsPath.appendingPathComponent(url.lastPathComponent)           try? FileManager.default.removeItem(at: destinationPath)           do {       try FileManager.default.copyItem(at: location, to: destinationPath)       self.modelUrl = destinationPath       print("File moved to: \(modelUrl?.absoluteURL)")     } catch let error {       print("Copy Error: \(error.localizedDescription)")     }   } } and then the quick look preview looks like this: import SwiftUI import QuickLook import ARKit struct ARQuickLookView: UIViewControllerRepresentable {   var allowScaling: Bool = true       func makeCoordinator() -> ARQuickLookView.Coordinator {     Coordinator(self)   }       func makeUIViewController(context: Context) -> QLPreviewController {     let controller = QLPreviewController()     controller.dataSource = context.coordinator     return controller   }       func updateUIViewController(_ controller: QLPreviewController,                 context: Context) {     // nothing to do here   }       class Coordinator: NSObject, QLPreviewControllerDataSource {     let parent: ARQuickLookView     let destinationPath = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0].appendingPathComponent("model.usdz")     private lazy var fileURL: URL = destinationPath           init(_ parent: ARQuickLookView) {       self.parent = parent       super.init()     }           func numberOfPreviewItems(in controller: QLPreviewController) -> Int {       return 1     }     func previewController(       _ controller: QLPreviewController,       previewItemAt index: Int     ) -> QLPreviewItem {       let fileURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0].appendingPathComponent("model.usdz")       print(fileURL)       let item = ARQuickLookPreviewItem(fileAt: fileURL)       print(item)       item.allowsContentScaling = parent.allowScaling       return item     }   } } struct ARQuickLookView_Previews: PreviewProvider {   static var previews: some View {     ARQuickLookView()   } } However, I get an error reading "Unhandled item type 13: contentType is: (null) #PreviewItem" I know the file is actually located at this location as I have opened it in Finder. Any help would be much appreciated. Thanks in advance, Louis
Posted
by
Post not yet marked as solved
0 Replies
342 Views
https://itunes.apple.com/lookup?bundleId=com.xxxx.xxxx while check this url in POST method then the version will shows updated version but when I check in GET method then it shows previous version.
Posted
by
Post not yet marked as solved
0 Replies
278 Views
Hello Guys, Have you tested requireManagedPasteboard key with your iOS beta, I have tested this successfully (On iOS 15 Beta 5 (iPhone 12)) but the still I am able to copy from Managed App quicklook (document preview) and paste to Unmanaged app. Can you please test it out and confirm your experiences please. Thanks Siva
Posted
by
Post not yet marked as solved
0 Replies
393 Views
I have an app on the Mac App Store (so sandboxed) that includes a QuickLook Preview Extension that targets Markdown files. It works just. But I'm in the process of updating it so that it displays inline images as well as styled text. However, despite setting Downloads read-only access permission (and user-selected, though I know that shouldn't be required: no open/save dialogs here) in the extension's entitlements, Sandbox refuses too allow access to the test image: I always get a deny(1) file-read-data error in the log. FWIW, the test file is referenced in the source Markdown as an absolute path. I've tried different signings and no joy. I’ve tried placing the referenced image in various other locations. Also no joy. Question is, is this just something QuickLook extensions cannot do from within the sandbox, or am I missing something? Is there anything extra I can do to debug this?
Posted
by
Post not yet marked as solved
0 Replies
497 Views
Hey! Dose AR quick look support Mask Material? I have seen the the face tracking have face Mask out, which the face will create occlusion for the face. So the object like helmet wont look like just floating over the head. Now I wanted to take that mask material and apply to my other project, like world tracking and image tracking, is this possible? thanks.
Posted
by
Post not yet marked as solved
3 Replies
2.7k Views
Hello, (sorry for long log attached within) There has been concern (long story) that my secondary apple ID, phone was somehow linked or registered within an app developer or anything other then default and looking for clarification. This log is directly from the phone/apple ID and the log was generated with a credible source. The apple ID/phone should not be associated with anything and no APP dev account should be associated within the log. Additionally my phone/apple ID that this log is associated with I am wondering if someone can tell me if there is anything to support or speculate that the phone is being shared or bundled in some fashion of any kind to share data, location, apps, or if there is anything such as coding of any kind that is anything other then what your standard phone would look like right out of the box with default settings. It's my suspicion that the apple id/phone log would support the issues that's been present of many issues that can be explained later. Any help would be greatly [appreciated.]( Log of Apple ID/phone in question - https://developer.apple.com/forums/content/attachment/7c971c69-4a7c-43a4-b5e4-42e9e180d161 )
Posted
by
Post not yet marked as solved
1 Replies
499 Views
I have a custom QLPreviewingController with a NSScrollView. When I click with the mouse anywhere inside the ql preview view I can drag the window. This prevent to drag the scrollbar. The problem exists only on big sur with custom quicklook appex.
Posted
by
Post not yet marked as solved
3 Replies
747 Views
Is it possible to write to an App Group's Container folder or UserDefaults from an iOS Thumbnail Extension or QuickLook Extension? It doesn't work. It does work for a Widget extension. I've added the App Group to the Entitlements of each extension. For writing a file to App Group Container I get Error Domain=NSCocoaErrorDomain Code=513 "Du hast nicht die Zugriffsrechte, um die Datei „quicklook 01 current.log“ im Ordner „DocumentInvestigation“ zu sichern." UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/<redacted: the container UUID>/DocumentInvestigation/quicklook 01 current.log, NSUnderlyingError=0x28090bb10 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} For setting App Group UserDefaults [User Defaults] Couldn't write values for keys ( &#9;&#9;example ) in CFPrefsPlistSource<0x2839cc700> (Domain: <redacted: the-group-identifier>, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access The use case is, that we are investigating an issue and would like to log to a file which we then can have customers send us.
Posted
by
Post not yet marked as solved
1 Replies
881 Views
Hello, I've been having some issues getting WKWebView or QuickLook rendering a preview of files with iWork type extensions (.pages, .numbers, .key) At first, I thought it was the contentType (or media type) not being set correctly, but I'm almost positive the correct one is application/vnd.apple.pages. I've seen older posts that reference the contentType as .pages.zip as iWork files at some point in time were directories, but it's my understanding that is no longer the case. I've tried the following media types application/zip, application/pdf, application/vnd.apple.pages and the default application/octet-stream see this doc for application/vnd.apple.pages confirmation.  iana.org/assignments/media-types/media-types.xhtml I tried to just use QuickLook thinking this framework would solve all my problems. Well, the result is better in the respect that QuickLook doesn't default to showing the file encoding when a preview can't be shown. But the file preview is still missing. See these basic implementations of WKWebView and QuickLook. Note: Target iOS 13.6 All iWork Apps are updated Assume files haven't been tampered with Storyboard wkwebview Pages_test.pages file is added into project and is in the correct target No protocol methods implemented WKWebView WKWebView class ViewController: UIViewController, WKUIDelegate, WKNavigationDelegate { @IBOutlet weak var webView:WKWebView! override func viewDidLoad() { &#9;&#9;super.viewDidLoad() &#9;&#9; &#9;&#9;webView.uiDelegate = self &#9;&#9;webView.navigationDelegate = self &#9;&#9; &#9;&#9;let url = Bundle.main.url(forResource: "pages_test", withExtension: "pages")! &#9;&#9; &#9;&#9;var data:Data? &#9;&#9;do { &#9;&#9;&#9;&#9;try data = Data(contentsOf: url) &#9;&#9;} catch { &#9;&#9;&#9;&#9;fatalError("Error fetching data") &#9;&#9;} &#9;&#9; &#9;&#9;webView.load(data!, mimeType: "application/vnd.apple.pages", characterEncodingName: "", baseURL: url.deletingLastPathComponent()) } QuickLook class ViewController: UIViewController {   var previewView:QLPreviewController!       override func viewDidLoad() {     super.viewDidLoad()     setUpQuickLookPreview()   }       override func viewDidAppear(_ animated: Bool) {     super.viewDidAppear(animated)     showQuickLookPreview()   }       func setUpQuickLookPreview(){     previewView = QLPreviewController()     previewView.dataSource = self     previewView.delegate = self     previewView.currentPreviewItemIndex = 0   }       func showQuickLookPreview(){     present(previewView, animated: true, completion: nil)   } } extension ViewController: QLPreviewControllerDataSource, QLPreviewControllerDelegate {   func numberOfPreviewItems(in controller: QLPreviewController) -> Int {     return 1   }       func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {     let url = Bundle.main.url(forResource: "pages_test", withExtension: "pages")!     return url as QLPreviewItem   } }    
Posted
by