我在 Xcode 10.3 中的界面生成器顶部出现错误,在单击报告错误并检查 log.txt 文件时,我发现无法打开模拟器。但是我没有启动任何模拟器。
这是 Log.txt 中发现的错误
Encountered an error communicating with IBAgent-iOS. (Failure reason: IBAgent-iOS failed to launch): Failed to boot device iPhone Xs (0B8270CC-2BFB-4BB6-90A5-6BA61468A1AD, iOS 12.4, Shutdown) for context <IBCocoaTouchToolLaunchContext: 0x7fe80e754ad0> toolName = IBAgent-iOS, description = <IBCocoaTouchPlatformToolDescription: 0x7fe80e2a0290> System content for IBCocoaTouchFramework-ElevenAndLater <IBSimulatorDeviceTypeDescription: 0x7fe80fab2f90> deviceType=com.apple.CoreSimulator.SimDeviceType.iPhone-XS (Failure reason: Failed to boot iPhone Xs (0B8270CC-2BFB-4BB6-90A5-6BA61468A1AD, iOS 12.4, Shutdown)): Unable to boot the Simulator. (Failure reason: launchd failed to respond.)
Error Domain=com.apple.InterfaceBuilder Code=-1 "Encountered an error communicating with IBAgent-iOS." …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 UTC 时区以 24 小时格式获取 currentTime。当我在不同的设备上调试我的应用程序时,我遇到了一个奇怪的问题。
该代码在我的设备上运行良好,但它在我表弟的装有 iOS 11.2 的 iPhone 中以 12 小时格式给出时间。因此,我尝试在具有相同操作系统的 iPhone X 设备上运行应用程序。
我不确定出了什么问题,但后来我也在其他一些设备上尝试了这个,并且该应用程序在所有其他设备上运行良好。PS 我的应用程序的旧版本也可以在堂兄的手机上使用相同的代码运行良好。
这是我用来获取 currentTime 的代码。
let dateFormatter = DateFormatter()
dateFormatter.timeZone = NSTimeZone(abbreviation: "UTC") as TimeZone!
dateFormatter.dateFormat = "EEEE"
dayOfWeekString = dateFormatter.string(from: NSDate() as Date)
dateFormatter.dateFormat = "HH"
let CurrentTime = dateFormatter.string(from: NSDate() as Date)
let CHour = Int(CurrentTime)!
Run Code Online (Sandbox Code Playgroud)
寻找解决方案