rea*_*n93 2 ios ios-simulator swift apple-m1 xcode13
为了节省我的(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 re-created.\nMay 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error copying sample content to path /Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460/data : Error Domain=NSCocoaErrorDomain Code=513 "You don\xe2\x80\x99t have permission to save the file \xe2\x80\x9cBC4197AA-A5E9-4611-98B3-4C96B2CCD460\xe2\x80\x9d in the folder \xe2\x80\x9cDevices\xe2\x80\x9d." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}\nMay 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSCocoaErrorDomain Code=513 "You don\xe2\x80\x99t have permission to save the file \xe2\x80\x9cBC4197AA-A5E9-4611-98B3-4C96B2CCD460\xe2\x80\x9d in the folder \xe2\x80\x9cDevices\xe2\x80\x9d." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}\nMay 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Failed to re-create device that was encountered in the creation state (realkstrawn93-ip13sim (BC4197AA-A5E9-4611-98B3-4C96B2CCD460, iOS 15.4, Creating)): Error Domain=NSCocoaErrorDomain Code=513 "You don\xe2\x80\x99t have permission to save the file \xe2\x80\x9cBC4197AA-A5E9-4611-98B3-4C96B2CCD460\xe2\x80\x9d in the folder \xe2\x80\x9cDevices\xe2\x80\x9d." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}\nMay 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: New device is stuck in creation state, deleting: realkstrawn93-ip13sim (BC4197AA-A5E9-4611-98B3-4C96B2CCD460, iOS 15.4, Creating)\nMay 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}\nMay 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}\nMay 3 13:27:12 realkstrawn93-m1mbp com.apple.dt.Xcode[24690] <Error>: ERROR creating device: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}\nMay 3 13:27:12 realkstrawn93-m1mbp com.apple.dt.Xcode[24690] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}\nRun Code Online (Sandbox Code Playgroud)\n尽管已经使用过,但请注意各种“您无权保存文件”错误chown -R在目录移动后已经使用过尝试纠正可能由此产生的任何权限问题。那么这里还有什么可能是错误的呢?
小智 7
我能够在这个答案的帮助下找到解决方法 /sf/answers/4081317831/
问题在于 CoreSimulatorService 需要完整的磁盘访问权限才能在单独的驱动器上创建文件。要授予访问权限,您需要拖放com.apple.CoreSimulator.CoreSimulatorService.xpc到系统偏好设置中的应用程序区域Security & Privacy > Privacy > Full Disk Access。您不能使用 + 图标,因为.xpc文件将呈灰色显示。
对我来说,这是 xpc 文件的路径:
/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc
| 归档时间: |
|
| 查看次数: |
3189 次 |
| 最近记录: |