• <small id='6g5eP'></small><noframes id='6g5eP'>

    <legend id='6g5eP'><style id='6g5eP'><dir id='6g5eP'><q id='6g5eP'></q></dir></style></legend>
    <tfoot id='6g5eP'></tfoot>

    • <bdo id='6g5eP'></bdo><ul id='6g5eP'></ul>

    1. <i id='6g5eP'><tr id='6g5eP'><dt id='6g5eP'><q id='6g5eP'><span id='6g5eP'><b id='6g5eP'><form id='6g5eP'><ins id='6g5eP'></ins><ul id='6g5eP'></ul><sub id='6g5eP'></sub></form><legend id='6g5eP'></legend><bdo id='6g5eP'><pre id='6g5eP'><center id='6g5eP'></center></pre></bdo></b><th id='6g5eP'></th></span></q></dt></tr></i><div id='6g5eP'><tfoot id='6g5eP'></tfoot><dl id='6g5eP'><fieldset id='6g5eP'></fieldset></dl></div>

        '设置&lt;NSObject&gt;'没有名为“anyObject"的成员.

        时间:2023-07-08
          <bdo id='jpG71'></bdo><ul id='jpG71'></ul>
          <tfoot id='jpG71'></tfoot>
          <i id='jpG71'><tr id='jpG71'><dt id='jpG71'><q id='jpG71'><span id='jpG71'><b id='jpG71'><form id='jpG71'><ins id='jpG71'></ins><ul id='jpG71'></ul><sub id='jpG71'></sub></form><legend id='jpG71'></legend><bdo id='jpG71'><pre id='jpG71'><center id='jpG71'></center></pre></bdo></b><th id='jpG71'></th></span></q></dt></tr></i><div id='jpG71'><tfoot id='jpG71'></tfoot><dl id='jpG71'><fieldset id='jpG71'></fieldset></dl></div>
              • <small id='jpG71'></small><noframes id='jpG71'>

                  <tbody id='jpG71'></tbody>

                <legend id='jpG71'><style id='jpG71'><dir id='jpG71'><q id='jpG71'></q></dir></style></legend>

                  本文介绍了'设置&lt;NSObject&gt;'没有名为“anyObject"的成员.- Xcode 6.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在检查是否选择了一个元素.

                  I'm checking to see if an element has been selected.

                  func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent)
                  {
                      // First, see if the game is in a paused state
                      if !gamePaused
                      {
                          // Declare the touched symbol and its location on the screen
                          let touch = touches.anyObject! as? UITouch
                          let location = touch.locationInNode(symbolsLayer)
                  

                  这之前在 Xcode 6.2 中编译得很好,但随着 6.3 的更新,let touch = touches.anyObject!as?UITouch"这行会抛出错误:

                  And this had previously compiled fine in Xcode 6.2 but with a 6.3 update, the line "let touch = touches.anyObject! as? UITouch" is throwing the error:

                  Set"没有名为anyObject"的成员

                  'Set' does not have a member named 'anyObject'

                  我已经阅读了许多类似的问题,但我似乎无法理解要使用该值,您需要先解包"它.尤其是因为答案似乎集中在通知上.

                  I've read through many similar question, but I can't seem to wrap my head around "To use the value, you need to "unwrap" it first." Especially because the answers seem to focus on notifications.

                  非常感谢.W

                  推荐答案

                  let touch =  touches.first as? UITouch
                  

                  .first 可以让你访问 UITouch 的第一个对象.

                  .first can allow you to access first object of UITouch.

                  由于 Xcode 6.3 使用 Swift (1.2) 的更新版本,您需要将旧代码转换为 Swift 1.2(编辑 -> 转换 -> 到最新的 Swift).

                  Since Xcode 6.3 uses an updated version of Swift (1.2) you need to convert your old code into Swift 1.2 (Edit -> convert -> To lastest Swift).

                  Swift 1.2,使用 Set's(Swift 中的新功能)而不是使用 NSSet's(Objective-C 中的旧功能).因此,touchbegan 函数也将其参数从 NSSet 更改为 Set.

                  Swift 1.2, uses Set’s (new in Swift) instead of using NSSet’s (old one in Objective-C). Thus the touchbegan function also changes its parameters from NSSet to Set.

                  欲了解更多信息,参考这个

                  这篇关于'设置&lt;NSObject&gt;'没有名为“anyObject"的成员.- Xcode 6.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用 RingtoneManager.ACTION_RINGTONE_PICKER 设置铃声? 下一篇:如何从 Swift 中的集合中获取随机元素?

                  相关文章

                1. <i id='S870Z'><tr id='S870Z'><dt id='S870Z'><q id='S870Z'><span id='S870Z'><b id='S870Z'><form id='S870Z'><ins id='S870Z'></ins><ul id='S870Z'></ul><sub id='S870Z'></sub></form><legend id='S870Z'></legend><bdo id='S870Z'><pre id='S870Z'><center id='S870Z'></center></pre></bdo></b><th id='S870Z'></th></span></q></dt></tr></i><div id='S870Z'><tfoot id='S870Z'></tfoot><dl id='S870Z'><fieldset id='S870Z'></fieldset></dl></div>

                    <bdo id='S870Z'></bdo><ul id='S870Z'></ul>
                  <legend id='S870Z'><style id='S870Z'><dir id='S870Z'><q id='S870Z'></q></dir></style></legend>

                  1. <tfoot id='S870Z'></tfoot>

                    <small id='S870Z'></small><noframes id='S870Z'>