You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS17.2下iPad mini 6的UIActivityViewController打印功能异常

iOS 17.2 UIActivityViewController 打印功能异常及控制台错误问题

环境与问题现象

  • 设备:40台MDM管理的不同型号iPad mini,其中4台新采购的iPad mini 6已升级至iOS 17.2
  • 自研应用通过UIActivityViewController分享生成的条码图片实现打印功能
  • 异常表现:
    • iOS 17.2设备触发打印时,仅显示顶部空栏,无打印机选项;但系统自带Notes应用可正常打印至Brother条码打印机
    • 旧设备触发打印时,能正常显示包含打印机选项的AirDrop对话框

相关代码

原实现代码

let renderer = UIGraphicsImageRenderer(size: CGSize(width: 1000, height: 400))
let BarcodeImg = renderer.image { ctx in

    let paragraphStyle = NSMutableParagraphStyle()
    paragraphStyle.alignment = .center

    let attrs: [NSAttributedString.Key: Any] = [
        .font: UIFont.systemFont(ofSize: 65),
        .paragraphStyle: paragraphStyle
    ]
    
    let myQRCode = generateBarcode(from: self.qrCodeLabel.text!)
    myQRCode?.draw(at: CGPoint(x: 15, y: 60))
    
    let string = self.qrCodeLabel.text!
    let attributedString = NSAttributedString(string: string, attributes: attrs)
    attributedString.draw(with: CGRect(x: 10, y: 10, width: 1000, height: 400), options: .usesLineFragmentOrigin, context: nil)
    
}
qrCodeImage.image = BarcodeImg

let screenSize: CGRect = UIScreen.main.bounds
let screenWidth = screenSize.width
let screenHeight = screenSize.height

let vc = UIActivityViewController(activityItems: [BarcodeImg], applicationActivities: [])
let popover = vc.popoverPresentationController
popover?.sourceView = view
popover?.sourceRect = CGRect(x: 32, y: 32, width: screenWidth, height: screenHeight)
present(vc, animated: true)

修改后的关键代码(功能恢复但出现错误)

将popover.sourceRect修改为以下内容后,可弹出包含打印机选项的对话框并完成打印,但Xcode控制台出现大量错误:

popover?.sourceRect = CGRect(x: self.view.bounds.midX, y: 32, width: 0, height: 0)

控制台错误信息

fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)}>
(501) personaAttributesForPersonaType for type:0 failed with error Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.mobile.usermanagerd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.mobile.usermanagerd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction.}
Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
elapsedCPUTimeForFrontBoard couldn't generate a task port
Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
elapsedCPUTimeForFrontBoard couldn't generate a task port
Failed to create 0x88 image slot (alpha=1 wide=1) (client=0x5c8de949) [0x5 (os/kern) failure]
<0x101c10b10> Gesture: System gesture gate timed out.
Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
elapsedCPUTimeForFrontBoard couldn't generate a task port
LPLinkMetadata: Failed to decode with error: Error Domain=NSCocoaErrorDomain Code=4864 "value for key 'root' was of unexpected class 'LPPlaceholderLinkMetadata' (0x1de8b3e38) [/System/Library/Frameworks/LinkPresentation.framework].
Allowed classes are:
{(
"'LPLinkMetadata' (0x1dd89e3d8) [/System/Library/Frameworks/LinkPresentation.framework]",
"'NSNull' (0x1dd678298) [/System/Library/Frameworks/CoreFoundation.framework]"
)}" UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'LPPlaceholderLinkMetadata' (0x1de8b3e38) [/System/Library/Frameworks/LinkPresentation.framework].
Allowed classes are:
{(
"'LPLinkMetadata' (0x1dd89e3d8) [/System/Library/Frameworks/LinkPresentation.framework]",
"'NSNull' (0x1dd678298) [/System/Library/Frameworks/CoreFoundation.framework]"
)}}
LPLinkMetadata: Failed to decode with error: Error Domain=NSCocoaErrorDomain Code=4864 "value for key 'root' was of unexpected class 'LPPlaceholderLinkMetadata' (0x1de8b3e38) [/System/Library/Frameworks/LinkPresentation.framework].
Allowed classes are:
{(
"'LPLinkMetadata' (0x1dd89e3d8) [/System/Library/Frameworks/LinkPresentation.framework]",
"'NSNull' (0x1dd678298) [/System/Library/Frameworks/CoreFoundation.framework]"
)}" UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'LPPlaceholderLinkMetadata' (0x1de8b3e38) [/System/Library/Frameworks/LinkPresentation.framework].
Allowed classes are:
{(
"'LPLinkMetadata' (0x1dd89e3d8) [/System/Library/Frameworks/LinkPresentation.framework]",
"'NSNull' (0x1dd678298) [/System/Library/Frameworks/CoreFoundation.framework]"
)}}

需求

寻求该问题的原因排查方向及解决方案。


内容的提问来源于stack exchange,提问作者Mike Volmar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 01:33:12