无法在 Xcode 6 beta 6 中引用本地函数错误 [英] Cannot reference a local function error in Xcode 6 beta 6

查看:31
本文介绍了无法在 Xcode 6 beta 6 中引用本地函数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从 beta 4 更新到 Xcode 6 beta 6,但收到一个我不明白的错误.

I have just updated to Xcode 6 beta 6 from beta 4 and I am receiving an error that I don't understand.

我收到错误无法从另一个本地函数引用本地函数".

I am getting the error 'Cannot reference a local function from another local function'.

        var alert = UIAlertController(title: "Start Over", message: "Are you sure you want to start over? This will erase your budget and all transactions.", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "I'm sure!", style: UIAlertActionStyle.Default, handler:{ (ACTION :UIAlertAction!)in
        resetView()
        }))
    alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))

    self.presentViewController(alert, animated: true, completion: nil)

错误出在 resetView() 代码行上.

The error is on the resetView() line of code.

推荐答案

错误信息很详细.

resetView 是一个本地函数,你不能从另一个本地函数引用它.

resetView is a local function and you cannot refer to it from another local function.

为了解决这个问题,将 resetView 移到本地范围之外.

In order to fix the issue move resetView outside of the local scope.

这篇关于无法在 Xcode 6 beta 6 中引用本地函数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆