UIActivityViewController 引发错误

UIActivityViewController is throwing error

提问人:siflJebatkundy 提问时间:10/11/2023 最后编辑:siflJebatkundy 更新时间:10/13/2023 访问量:72

问:

我遇到了UIActivityViewController的问题。当我尝试通过以下方式共享图像时:

let activityViewController = UIActivityViewController(activityItems: [UIImage(named: "image")], applicationActivities: nil)

我收到错误:

    2023-10-11 09:45:33.759783+0200 Neview[16037:1721794] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x6000006c60d0 _UIActivityActionCellTitleLabel:0x15c5a3750.height >= 22   (active)>",
    "<NSLayoutConstraint:0x6000006c5b80 _UICollectionViewListCellContentView:0x15c5a1ec0.height >= _UIActivityActionCellTitleLabel:0x15c5a3750.height + 30   (active)>",
    "<NSLayoutConstraint:0x6000006c2850 'UIView-Encapsulated-Layout-Height' _UICollectionViewListCellContentView:0x15c5a1ec0.height == 30   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000006c60d0 _UIActivityActionCellTitleLabel:0x15c5a3750.height >= 22   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

但是,如果我将UIActivityViewController参数更改为UIImage()以外的其他参数,例如:

let activityViewController = UIActivityViewController(activityItems: [MyCustomUIView()], applicationActivities: nil)

它停止出现错误。

有人知道是什么原因导致了这个问题吗?

iOS Swift UIView UIKit的

评论

0赞 HangarRash 10/12/2023
你为什么要分享一个空图像?您是否遇到非空图像的问题?
0赞 siflJebatkundy 10/13/2023
这只是一个例子,即使我尝试共享非空图像,我也会出现错误
1赞 HangarRash 10/13/2023
可悲的是,iOS 在各种 UI 组件中存在一些约束问题。除了制作一个简单易用的演示应用程序来复制问题并使用错误报告提交给 Apple 之外,您无能为力 feedbackassistant.apple.com

答: 暂无答案