-2

In an Xcode project, how can I write any Swift codes that crashes the Application on startup once it’s launched/run on the simulator or device?

1 Answers1

1

You can follow app lifecycle events in your UIApplicationDelegate. For example application(_:didFinishLaunchingWithOptions:)) is called, when the app started and a little time before it's visible. You can put the crashing code there.

There are a few ways to crash the app. One of them is to call fatalError().

lazarevzubov
  • 1,767
  • 2
  • 14
  • 24