iOS 11 UIActivityViewController crashes printing PDF

Viewed 1079

I have a simple invocation of a UIActivityViewController in my viewController which passes in a String, a UIImage and a PDF (as Data). The code worked fine in iOS 10, and continues to work fine with all functions (e.g. Copy, Mail, Markup as PDF) other than Print which crashes with nothing on the console. If I comment out the PDF representation, the Print function works perfectly well with the UIImage. The PDF is well formed, and displays as expected in Mark up PDF and AirDrop.

Does anyone have any insights into what has changed?

Update

No change in Xcode 9b5, iOS 11b5.

override func action(button: UIBarButtonItem) {
    guard let layer = self.currentLayer, let cgImage = layer.thumbnail else { return }
    var representations: [Any] = [
        UIImage(cgImage: cgImage),
        layer.collection.svg, // String representation
        ]

    if let pdf = layer.pdfDataDefault() { // Data
        representations.append(pdf)
    }

    let activityVC = UIActivityViewController(activityItems: representations, applicationActivities: nil)
    activityVC.popoverPresentationController?.barButtonItem = button
    self.present(activityVC, animated: true) {
        // ...
    }
}

Call stack at the crash (which is "Thread 1: EXC_BAD_ACCESS (code=1, address=0x58)") shown below. Nothing shown on console.

enter image description here

Crash log :

Date/Time: 2017-08-06 12:34:50 +0100 OS Version: iPhone OS 11.0 (Build 15A5327g) Architecture: arm64 Report Version: 26

Data Source: KPerf Lightweight PET Kernel Cache: 0xffffffe000000000 7520411B-BFF1-86C3-E564-A279565AC465 Reason: Fence-hang-com.apple.DocumentManager.Service: 627ms handling fence, blown-fence (fence duration=629ms)

Command: com.apple.DocumentManager.Service Path: /System/Library/PrivateFrameworks/DocumentManagerUICore.framework/PlugIns/com.apple.DocumentManager.Service.appex/com.apple.DocumentManager.Service Identifier: com.apple.DocumentManagerUICore.Service Version: 1.0 (1) Parent: launchd 1 PID: 1054

Duration: 0.60s Steps: 12 (50ms sampling interval)

Hardware model: J98aAP Active cpus: 2

0 Answers
Related