小编Kyl*_*KIM的帖子

'无法在descriptionForLayoutAttribute_layoutItem_coefficient中创建描述.有些东西是零

首先,我有3个不同的UIViews来替换iPad故事板上的Split View Controller中的细节视图

它在iOS8 iPad上运行良好.但是当我加载其中一个细节视图时,应用程序在iOS7和iOS 6 Simulator中运行时崩溃.

我只假设这是因为我的故事板上的自动布局.

有谁知道如何修理它?

2014-09-25 04:15:19.705 PSTappsperance[48327:60b] Pad AppDelegate ########
2014-09-25 04:15:27.869 PSTappsperance[48327:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil'
*** First throw call stack:
(
0   CoreFoundation                      0x0000000110a5c495 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x00000001107af99e objc_exception_throw + 43
2   CoreFoundation                      0x0000000110a5c2ad +[NSException raise:format:] + 205
3   Foundation                          0x00000001104ec548 descriptionForLayoutAttribute_layoutItem_coefficient + 145
4   Foundation                          0x00000001104ec3bc -[NSLayoutConstraint equationDescription] + 216
5   Foundation                          0x00000001104ec831 -[NSLayoutConstraint description] + …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c ios autolayout

31
推荐指数
2
解决办法
1万
查看次数

在Xcode5.1中构建一个项目,该项目在Xcode 6 GM中进行了修改,用于测试旧版本的iOS

我的应用程序至少使用Xcode5.1故事板支持iOS6.

在Xcode 6 GM中完成了几项工作之后,我需要在iOS 6 Simulator上进行测试.Xcode 6 GM没有iOS 6模拟器.所以,我在Xcode 5.1中打开了我的项目.

但它无法建立.我甚至无法在Xcode5.1中打开故事板.

它在导航窗格中说

Main_iPhone.storboard
Interface Builder Storyboard Compiler Error
The document"(null)" requires Xcode6.0 or later.
Run Code Online (Sandbox Code Playgroud)

当我点击它时,会出现提示

The document "Main_iPhone.storyboard" requires Xcode 6.0 or later.
This version does not support constraints to layout margins. Open this document with Xcode 6.0 or later.
Run Code Online (Sandbox Code Playgroud)

iphone storyboard ios xcode5 xcode6

4
推荐指数
1
解决办法
4217
查看次数

NSWindow 关闭后 activateIgnoringOtherApps 和 makeKeyAndOrderFront 不起作用

我从一个故事板项目开始。我把菜单栏项目。单击菜单栏项时,会在 AppDelegate.swift 中触发以下方法。

func setWindowVisible() {
    NSApp.activateIgnoringOtherApps(ture)
    NSApp.mainWindow?.makeKeyAndOrderFront(self)
}
Run Code Online (Sandbox Code Playgroud)

这使我的应用程序位于前面。但是一旦我单击关闭按钮(窗口上的红色按钮),它就永远不起作用。

无论我关闭窗口,它过去都可以在基于非故事板的项目中工作。

我已经设定

NSApp.mainWindow?.releasedWhenClosed = false
Run Code Online (Sandbox Code Playgroud)

在 applicationDidFinishLaunching() 中

有人可以帮我吗?

macos cocoa nswindow nsstoryboard

2
推荐指数
1
解决办法
3217
查看次数

Swift-在Cocoa中播放系统默认声音的最简单方法(macOS,OS X)

我正在学习可可编程.

我只需要在异步任务完成或在我自己的Cocoa项目中失败时播放声音.

所以我想知道最简单的方法是什么.

虽然它应该很容易,但我还没有在Swift中找到它.

提前谢谢了

macos cocoa swift

2
推荐指数
3
解决办法
3869
查看次数

为什么我不能在类/静态方法中使用 private、internal、fileprivate 方法?

假设有两个类

文件A:

import Foundation
class ClassA {
    /// a method that I don't want to exposed to others
    static func privateMethod(append aStirng:String) -> String {
        return  "Appended String:" + aStirng
    }

    static func classMethod() -> String {
        let theString = privateMethod(append: "random string") //problematic line when privateMethod(append:) is declared as private,fileprivate,internal...
        return theString
    }
}
Run Code Online (Sandbox Code Playgroud)

文件B:

import Foundation
class ClassB {
   func aMethod() {
      print(ClassA.classMethod())
   }
}
Run Code Online (Sandbox Code Playgroud)

这有效。但我不希望 ClassB 使用privateMethod(append:)like ClassA.privateMethod(append: "")。所以我用 , 标记了该方法privateinternal …

swift

2
推荐指数
1
解决办法
2551
查看次数