我最近从使用Catalina beta的Macbook Pro上的SwiftUI编码更改为使用Mojave 10.14.6 (18G103)
的Macbook Pro。
使用iPhone模拟器,每当我聚焦TextField
时,即使最简单的应用程序也会挂起。我无法输入任何文本,也无法聚焦于其他文本字段。
但是使用iPhone Device(而不是模拟器)或使用Catalina Beta(带有模拟器或设备),它可以工作(应用程序不会挂起,并且文本字段接收输入)。
还有其他人有这个问题吗?
struct ContentView: View {
@State private var firstName = ""
@State private var lastName = ""
// Using an iOS 13 Simulator, focusing any of the TextFields below on macOS Mojave result in the app hanging. We cannot input anything and we cannot focus another textfield.
// However, this works just fine on macOS Catalina Beta `19A558d` (will upgrade to Beta 11 now)
var body: some View {
VStack {
TextField("First", text: $firstName)
TextField("Last", text: $lastName)
Text("Your name: '\(firstName) \(lastName)'")
}
}
}
尝试退出模拟器,然后在终端中运行此cmd:
rm〜/ Library / Preferences / com.apple.iphonesimulator.plist
也许不是最方便的解决方案,但是自从Catalina今天发布以来,我尝试对其进行更新,此问题已解决。