使用未声明的类型AutoreleasingUnsafePointer Xcode 6 beta 6

时间:2014-09-06 11:03:51

标签: swift xcode6

以下代码给出了编译错误"使用未声明的类型AutoreleasingUnsafePointer"

    var myString: AutoreleasingUnsafePointer<NSString?>

我是否错过了编译器设置步骤?

由于

2 个答案:

答案 0 :(得分:7)

documentation revision history

中所述
  

更新了指针部分,以反映UnsafePointer已替换为UnsafeMutablePointerConstUnsafePointer已替换为UnsafePointerAutoreleasingUnsafePointer已被替换为AutoreleasingUnsafeMutablePointer

所以你必须使用AutoreleasingUnsafeMutablePointer

答案 1 :(得分:1)

我遇到了同样的问题,但是,使用NSError。在新版本的Xcode(6.4)和Swift(以前的版本2)中,必须使用:

#include <iostream>
#include <windows.h>
using namespace std;


int main()
{
    HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD upPos = {20,28};
    COORD downPos = {50, 0};
    char endState;
    while ( SOMETHING )
    {
      COORD upPos = {20,28};
      COORD downPos = {50, 0};
        while (upPos.Y >=0)
        {
            SetConsoleCursorPosition(screen,upPos);
            cout << "UP" << endl;
            upPos.Y++;

            SetConsoleCursorPosition(screen,upPos);
            cout << "  " << endl;
            upPos.Y -=2;

            SetConsoleCursorPosition(screen,downPos);
            cout << "DOWN" << endl;
            downPos.Y--;

            SetConsoleCursorPosition(screen,downPos);
            cout << "    " << endl;
            downPos.Y+=2;

            Sleep(100);

        }

    }
}