为了节省我的(M1,2020)MacBook Pro(MYD82LL/A)内部驱动器上宝贵的 256GB 磁盘空间,我在安装 Xcode 后在 macOS 终端中运行了以下命令,以移动所有空间 -将组件占用到我格式化时命名为“Developer”的 2TB 外部驱动器中:
\nsudo mv /Applications/Xcode.app /Volumes/Developer/Applications/Xcode.app && sudo ln -s /Volumes/Developer/Applications/Xcode.app /Applications/Xcode.app\nsudo mv ~/Library/Developer/CoreSimulator /Volumes/Developer/CoreSimulator && ln -s /Volumes/Developer/CoreSimulator ~/Library/Developer/CoreSimulator && sudo chown -R $USER:staff /Volumes/Developer/CoreSimulator\nRun Code Online (Sandbox Code Playgroud)\n尽管绝对确保 CoreSimulator 文件夹具有正确的所有权和权限(因此sudo chown -R $USER:staff /Volumes/Developer/CoreSimulator如上所述),但我在尝试模拟设备时仍然收到此错误(图像缩小,因为 2880x1800 Retina 分辨率会推高屏幕截图的文件大小)过去 2MB):
更奇怪的是,我在 Xcode 中尝试执行此操作,同时还在tail -f ~/Library/Logs/CoreSimulator/CoreSimulator.log单独的终端窗口中运行。鉴于我确信(通过chown)确保我已经对移动的目录具有写访问权,因此生成的实时日志信息似乎违背逻辑:
May 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Warning>: Device BC4197AA-A5E9-4611-98B3-4C96B2CCD460 encountered in creation state at launch. The device will be …Run Code Online (Sandbox Code Playgroud) 尝试使用 C++ 克隆“yes”命令作为一个小实验(这是在 Ubuntu 12.10 上),这里有一个小问题:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
using namespace std;
void yes (char* cmd[]) {
if ( cmd != NULL ) {
while (true) {
cout << cmd[1] << endl;
}
} else {
while (true) {
cout << "y" << endl;
}
}
}
int main(int argc, char** argv[]) {
yes(argv[1]);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我保持原样,我会收到标题中描述的警告。如果我删除 argv 上的一个星号,我会收到关于将“char*”转换为“char**”的错误。并删除额外的功能(即把它全部放在 main 中,像这样):
int main(int argc, char** argv) {
if ( argv != NULL …Run Code Online (Sandbox Code Playgroud)