以下代码给出了编译错误"使用未声明的类型AutoreleasingUnsafePointer"
var myString: AutoreleasingUnsafePointer<NSString?>
我是否错过了编译器设置步骤?
由于
答案 0 :(得分:7)
如documentation revision history
中所述更新了指针部分,以反映
UnsafePointer
已替换为UnsafeMutablePointer
,ConstUnsafePointer
已替换为UnsafePointer
,AutoreleasingUnsafePointer
已被替换为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);
}
}
}