You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS模拟器无法设置12:00等整点时间的问题求助

iOS模拟器状态栏整点时间设置失败问题解决

问题现象

  • 可正常执行的命令:
    xcrun simctl status_bar "iPhone 15 Pro Max" override --time "12:01"
    
  • 执行失败的命令(含整点时间的情况):
    xcrun simctl status_bar "iPhone 15 Pro Max" override --time "12:00"
    xcrun simctl status_bar "iPhone 15 Pro Max" override --time "00:00"
    xcrun simctl status_bar "iPhone 15 Pro Max" override --time "24:00"
    
  • 报错信息:

    An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
    Simulator device failed to complete the requested operation.
    Invalid argument
    Underlying error (domain=NSPOSIXErrorDomain, code=22):
    Invalid, non-ISO date/time string
    Invalid argument

原因分析

xcrun simctl status_bar的--time参数对整点时间的格式校验存在特殊限制:仅输入HH:00格式会被判定为非ISO标准格式,而带非0分钟的HH:mm(如12:01)可正常通过校验。

解决方案

方案1:使用带秒数的时间格式

在整点时间后追加:00秒数,即可绕过格式校验:

# 设置12:00
xcrun simctl status_bar "iPhone 15 Pro Max" override --time "12:00:00"
# 设置00:00
xcrun simctl status_bar "iPhone 15 Pro Max" override --time "00:00:00"

方案2:使用完整ISO 8601日期时间格式

采用YYYY-MM-DDTHH:mm:ss的完整日期时间格式,同样可正常生效:

xcrun simctl status_bar "iPhone 15 Pro Max" override --time "2024-05-20T12:00:00"

以上两种方案均可让模拟器状态栏正确显示整点时间,避免触发格式错误。

内容的提问来源于stack exchange,提问作者iDecode

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 11:02:45