gpt4 book ai didi

ios - 为什么 ActivityViewController 在控制台中显示自动约束错误?

转载 作者:行者123 更新时间:2023-11-30 14:17:29 28 4
gpt4 key购买 nike

我正在尝试在我的应用程序中实现共享按钮,因此很自然地,我转向了 UIActivityViewController。由于某种原因,每当我按下共享按钮并弹出该按钮时,我都会在日志中收到以下消息:

    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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7c0a65d0 V:[UIView:0x7c0a2fa0(<=528)]>",
"<NSLayoutConstraint:0x7c0a6540 UIView:0x7c0a2fa0.height == UIView:0x7c0a2e60.height>",
"<NSLayoutConstraint:0x7c0a7100 _UIAlertControllerView:0x7c0a27f0.height == UIView:0x7c0a2e60.height>",
"<NSLayoutConstraint:0x7c0b1660 V:[_UIAlertControllerView:0x7c0a27f0(568)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7c0a65d0 V:[UIView:0x7c0a2fa0(<=528)]>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-06-20 15:32:43.885 App[19268:300248] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x78fc3e70 V:[UIView:0x78ff1eb0(<=528)]>",
"<NSLayoutConstraint:0x78fc3de0 UIView:0x78ff1eb0.height == UIView:0x78fb9670.height>",
"<NSLayoutConstraint:0x78fc5aa0 _UIAlertControllerView:0x78ff69f0.height == UIView:0x78fb9670.height>",
"<NSLayoutConstraint:0x78f58860 V:[_UIAlertControllerView:0x78ff69f0(568)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x78fc3e70 V:[UIView:0x78ff1eb0(<=528)]>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-06-20 15:32:48.691 App[19268:300248] viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x79982700 {Message=Service Connection Interrupted}

我在调用它时并没有做任何花哨的事情,只是最基本的:

let someText:String = "Hello"
let activityViewController = UIActivityViewController(activityItems: [someText], applicationActivities: nil)
activityViewController.excludedActivityTypes = [
UIActivityTypePostToWeibo,
UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo
] self.navigationController!.presentViewController(activityViewController,
animated: true,
completion: nil)

这可能是 Xcode beta 7/iOS 9 的错误吗?或者我错过了什么?我应该担心吗?

最佳答案

或者:

  1. 这是一个 Apple 错误 - 将其报告给 https://feedbackassistant.apple.com/只要它仍处于测试阶段
  2. 您从一个超大的 View Controller 中呈现模式(帧中的错误?),然后约束 V:[UIView:0x7c0a2fa0(<=528)休息

你应该担心吗?

  1. 它不会导致崩溃,但日志存在仍然是程序员错误的迹象,理想情况下,如果您故意想要打破约束,则可以为约束提供优先级

关于ios - 为什么 ActivityViewController 在控制台中显示自动约束错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30954171/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com