【问题标题】:Undeclared identifier in xCode 5xCode 5 中未声明的标识符
【发布时间】:2013-11-22 16:12:05
【问题描述】:

我刚刚对此进行了编码,然后弹出一个错误(使用未声明的标识符“RandomPosition”)。我是 xCode 的新手,我需要帮助...这些是行:

  RandomPosition = arc4random() %25;
  RandomPosition = RandomPosition + 75;
  Obstacle.center = CGPointMake(570, RandomPosition);

  RandomPosition = arc4random() %1;
  Floor.center = CGPointMake(550, 1);

另外,你们中有人知道如何在 xCode 中让角色跳跃吗?

非常感谢!

【问题讨论】:

  • 欢迎来到 Stackoverflow。快速搜索得到 this。我知道您是新手,但请记住,您的一些研究对帮助您有很长的路要走。到目前为止,您尝试过什么吗?请先展示您的努力,以便其他人可以帮助您。另外,请阅读FAQHow to Ask

标签: xcode5 undeclared-identifier


【解决方案1】:

您需要提供数据类型和标识符:

long RandomPosition = arc4random() %25;

(或者可能是intunsigned 或其他)。

此外,按照惯例,您对类使用大写单词,对实例和变量使用小写单词,因此应该是:

long randomPosition = arc4random() %25;

但是,您的标识符是合法的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-14
    • 1970-01-01
    • 1970-01-01
    • 2015-12-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多