main.m 1.0 KB

12345678910111213141516171819202122
  1. //go:build ios
  2. // Minimal bootstrap: delegate comes from Go archive (WailsAppDelegate)
  3. #import <UIKit/UIKit.h>
  4. #include <stdio.h>
  5. int main(int argc, char * argv[]) {
  6. @autoreleasepool {
  7. // Disable buffering so stdout/stderr from Go log.Printf flush immediately
  8. setvbuf(stdout, NULL, _IONBF, 0);
  9. setvbuf(stderr, NULL, _IONBF, 0);
  10. // Call UIApplicationMain IMMEDIATELY and start NOTHING else here. Do not
  11. // start the Go runtime yet: starting it concurrently with UIApplicationMain
  12. // intermittently corrupts the FrontBoard launch handshake on a physical
  13. // device, so the app delegate's didFinishLaunchingWithOptions never fires
  14. // (blank cold launch / 0x8BADF00D). Instead, the WailsAppDelegate (provided
  15. // by the Go archive) starts the Go runtime itself from
  16. // didFinishLaunchingWithOptions — i.e. only AFTER UIKit has delivered the
  17. // launch — so the runtime never races the launch handshake.
  18. return UIApplicationMain(argc, argv, nil, @"WailsAppDelegate");
  19. }
  20. }