试图了解我在使用以下代码时犯了什么错误。
这是一个 Mac 应用程序,Xcode 版本 12.4。我的问题是 applicationDidFinishLaunching
永远不会被触发。
import SwiftUI
@main
struct TestApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var Delegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(aNotification: NSNotification) {
let alert = NSAlert.init()
alert.messageText = "Hello world"
alert.informativeText = "Information text"
alert.addButton(withTitle: "OK")
alert.addButton(withTitle: "Cancel")
alert.runModal()
}
}
答案 0 :(得分:1)
您输入错误。不是“a”而是“_”
#include <iostream>
using namespace std;
int main(){
int a=68;
cout<<char(a);
char c='D';
cout<<int(c);
return 0;
}