我通过brew或google官方网站安装它并不重要。
当我启动它时,它返回一条错误消息:
Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Identifier: com.google.Chrome
Version: 78.0.3904.70 (3904.70)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Google Chrome [25447]
User ID: 501
Date/Time: 2019-10-29 21:12:38.185 +0100
OS Version: Mac OS X 10.15 (19A602)
Report Version: 12
Bridge OS Version: 4.0 (17P572)
Anonymous UUID: 624E795F-4392-2D73-55A9-FA070AADAF67
Sleep/Wake UUID: BA0934C2-9072-4B7F-8D72-335B29B00F6C
Time Awake Since Boot: 41000 seconds
Time Since Wake: 780 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000 …Run Code Online (Sandbox Code Playgroud) 我是 Xcode、macOS 开发等方面的新手。所以也许只是因为我是新手 - 但我无法尽全力制作一个简单的打印输出来控制台工作。
我为我的问题创建了一个最小的非工作示例:
import SwiftUI
struct Test: View {
@State var message = "Test"
var body: some View {
Button(action: {
print("test worked")
message = "test worked"
}) {
Text(message)
}
}
}
struct Test_Previews: PreviewProvider {
static var previews: some View {
Test()
}
}
Run Code Online (Sandbox Code Playgroud)
执行此操作时,按钮文本会发生变化,但控制台中不会出现任何内容。
我尝试按照本教程进行操作,但它也不起作用:https ://www.hackingwithswift.com/read/18/2/basic-swift-debugging-using-print
我尝试根据此线程启用调试预览:How to print() to Xcode console in SwiftUI?
没有什么帮助..我正在使用 Xcode 版本 12.1 (12A7403) 顺便说一句。
我正在尝试创建这个代码块:
var nextWorkday time.Date
// var nextWorkday *time.Date // neither works
yyyy, mm, dd := now.Date()
goalTime, _ := time.ParseDuration(fmt.Sprintf("%fh", *goal))
goalSeconds := int(goalTime.Seconds())
if date.Weekday() != time.Friday { // wait till the next workday (7am + difference)
nextWorkday = time.Date(yyyy, mm, dd+1, 7, 0, 0+goalSeconds, 0, now.Location())
} else {
nextWorkday = time.Date(yyyy, mm, dd+3, 7, 0, 0+goalSeconds, 0, now.Location())
}
time.Sleep(nextWorkday)
Run Code Online (Sandbox Code Playgroud)
重要的断点已经是第一行。我不知道如何声明自定义类型的新变量。现在我收到错误:
time.Date is not a type
我究竟做错了什么?任何帮助表示赞赏!