xcode Swift iOS Playground:发送延迟道具时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25674183/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:29:18  来源:igfitidea点击:

Swift iOS playground: Error sending deferral props

iosxcodeswiftsprite-kitswift-playground

提问by maltalef

With an iOS playground set up as simply as this:

像这样简单地设置一个 iOS 游乐场:

import UIKit
import SpriteKit
import XCPlayground

let s = CGSize(width: 300, height: 300)
let f = CGRect(origin: CGPointZero, size: s)
let view = SKView(frame: f)
let scene = SKScene(size: s)
scene.backgroundColor = SKColor.redColor()
view.presentScene(scene)
XCPShowView("main view", view)

I'm getting this in the console:

我在控制台中得到这个:

2014-09-04 17:02:13.358 SpriteKitBETA7[2009:20695] Error sending deferral props: 0x10000003

There IS a "main view" box in the Assistant Editor thing, but it doesn't display anything. This exact same code (with import Cocoainstead of import UIKit) works perfectly on an OSX playground. I am aware I can just test stuff in an OSX playground (though it would be more convenient on an iOS one since I don't want to use Yosemite but I do have the iOS7 SDK) and copy-paste to my project, but I wanted to know if anyone understood what's happening here.

助理编辑器中有一个“主视图”框,但它不显示任何内容。这个完全相同的代码(用import Cocoa代替import UIKit)在 OSX 操场上完美运行。我知道我可以在 OSX 操场上测试东西(虽然在 iOS 上会更方便,因为我不想使用优胜美地,但我有 iOS7 SDK)并复制粘贴到我的项目,但我想知道是否有人了解这里发生的事情。

回答by Tallyn Turnbow

Per the Xcode 6 Release Notes, you will want to enable Run in Full Simulatorin the File Inspector. Keep in mind this will run kind of slow since it is running through iOS Simulator. You'll have to wait a while for the iOS Simulator to launch before your XCPShowViewstarts displaying in the playground's Timeline.

根据Xcode 6 发行说明,您需要在文件检查中启用在完整模拟器运行。请记住,这会运行得有点慢,因为它是通过 iOS 模拟器运行的。在XCPShowView开始显示在Playground的时间轴中之前,您必须等待 iOS 模拟器启动。

  1. In the Xcodemenu bar, go to View> Utilities> Show File Inspector(?+?+1)
  2. In the File Inspector on the right, under Playground Settings, make sure the Platformis set to iOS
  3. Make sure Run in Full Simulatoris checked.
  1. Xcode菜单栏中,转到View> Utilities> Show File Inspector( ?+ ?+ 1)
  2. 在右侧的文件检查器中,在Playground Settings 下,确保平台设置为iOS
  3. 确保选中在完整模拟器中运行

If you mouse over the Run in Full Simulatoroption it explains that you should use this with views that animate or use OpenGL. Both of which apply to using either SceneKitor SpriteKit.

如果您将鼠标悬停在Run in Full Simulator选项上,它会说明您应该将它用于动画或使用 OpenGL 的视图。这两者都适用于使用SceneKitSpriteKit

回答by kawingkelvin

What did you see? I got as far as seeing a scene view with a color background I want. Try this:

你看见什么了?我看到了带有我想要的彩色背景的场景视图。尝试这个:

import UIKit
import SceneKit
import QuartzCore
import XCPlayground

let view = SCNView(frame: CGRectMake(0, 0, 300, 300))
let myScene = SCNScene()
view.scene = myScene
view.backgroundColor = UIColor.blueColor()
view.backgroundColor = UIColor.yellowColor()

let root = view.scene?.rootNode

XCPShowView("The Scene View", view)

You can test it by diff color, and it rendered it. However, if i add a sphere to the root node, nothing happens. And I also see this in my Console Output:

您可以通过 diff 颜色测试它,并渲染它。但是,如果我向根节点添加一个球体,则什么也不会发生。我也在我的控制台输出中看到了这一点:

2014-09-13 16:59:35.766 SceneKitPlayground[23682:13804922] Error sending deferral props: 0x10000003

2014-09-13 16:59:35.766 SceneKitPlayground[23682:13804922] 发送延迟道具时出错:0x10000003

Additionally, if I switch the thing to OS X, the same code that add the sphere will work.

此外,如果我将事物切换到 OS X,添加球体的相同代码将起作用。

回答by dylanrw

I managed to get it running by opening the file inspector, changing the playground settings to OSX, then back to iOS and checking 'Run in Full Simulator'. This is in XCode 6.1.

我设法通过打开文件检查器,将 Playground 设置更改为 OSX,然后返回 iOS 并选中“在完整模拟器中运行”来使其运行。这是在 XCode 6.1 中。