我有一個上的UIViewController
所示(名爲viewCon這裏)的UIActivityViewController
:UIActivityViewController,無法同時滿足約束,在設備上時8.x的編譯爲iOS 7.x的
// items contains text and/or image
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
activityViewController.excludedActivityTypes = @[UIActivityTypePostToWeibo, UIActivityTypeAssignToContact];
[viewCon presentViewController:activityViewController animated:YES completion:NULL];
我使用Xcode 6.1。我的應用的部署目標爲7.0。我在兩個物理iPhone(5S(8.0.2)和6(8.1))上運行它。
當我在物理設備(不是模擬器)上編譯iOS 7.x的應用程序時,將顯示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:0x1742941e0 UIView:0x174385960.bottom == _UIAlertControllerView:0x134ef4fc0.bottom>",
"<NSLayoutConstraint:0x174293d80 V:|-(0)-[UIView:0x170385960] (Names: '|':_UIAlertControllerView:0x134ef4fc0)>",
"<NSLayoutConstraint:0x17429a270 UIView:0x170385960.bottom <= _UIAlertControllerView:0x134ef4fc0.bottom>",
"<NSLayoutConstraint:0x174292cf0 UIView:0x174385960.centerY == UIView:0x170385960.centerY>",
"<NSLayoutConstraint:0x174294410 V:|-(>=8)-[UIView:0x174385960] (Names: '|':_UIAlertControllerView:0x134ef4fc0)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x17429a270 UIView:0x170385960.bottom <= _UIAlertControllerView:0x134ef4fc0.bottom>
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.
當我編譯和運行的iOS 8.x一切正常。但我當然需要爲iOS 7.x編譯兼容性。
UIViewController
使用使用Autolayout的.xib。但我試圖不使用Autolayout並出現同樣的問題。我嘗試了另外兩個項目,也在iOS 7上,它仍然是一樣的。
我也試圖呈現activityViewController前添加以下代碼,但同樣的問題:
[activityViewController.view setTranslatesAutoresizingMaskIntoConstraints:NO];
我看着別人的開發人員有同樣的問題(here),但它是由Xcode的6公測引起的。我有版本6.1。
我有類似的問題,看起來像有沒有爲它的解決方案呢。如果您的項目最低允許版本爲7.x,則您必須使用iOS 8.x SDK編譯項目,並且所有項目都可以在iOS 7.x上正常工作。 – 2014-11-04 15:21:31
在8.x iPad上編譯時發生這種情況。你知道那裏是從哪裏來的嗎? – 2015-06-30 05:06:38