Test Background Task in Xcode

snippets

I am absolutely going to forget this (again) but if your app has a background task scheduled with BGTaskScheduler you can manually trigger it by pausing the app in the Xcode debugger and running the debug command

e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"com.your.domain.task-id"]

When you continue the app it will trigger your background task.

You have to do this on a real device since BGTaskScheduler is not present on simulators.

Was That an Earthquake? v2.0 Released

apps

Was that an Earthquake? v2.0 is now available for macOS, iOS, and visionOS.

Updates

  • UI fixes and tweaks.
  • Improved serialization.
  • iOS and visionOS support background updates.
  • All versions will periodically import earthquakes while active.
  • Stats view for data stored on-device.
  • Data management view allows for deletion of all data or earthquakes within a specified time range.
  • Earthquakes are now automatically imported when you select a new day.

Please note that this version removes CloudKit syncing in favor of fetching data directly from USGS. Data is cached locally on the device and can be removed from the data management view.

Download on the App Store

Support Multiple Scenes

snippets

In your applications Info.plist add a new setting for Application Scene Delegate. Xcode will create a dictionary with 2 entries.

  • Enable Multiple Scenes
  • Scene Configuration

Enable Multiple Scenes is a boolean with a default value of NO. Change this to YES.

Create a new simulator from CLI

snippets

Create a new visionOS simulator. Command takes a name, device type, and runtime.

% xcrun simctl create "TestAVP" com.apple.CoreSimulator.SimDeviceType.Apple-Vision-Pro-4K com.apple.CoreSimulator.SimRuntime.xrOS-26-2 
4F8B10C1-90F3-4E91-8A73-AED33CACE123

Curious Case of the Missing Simulators

devlogs

In Xcode I recently encountered an issue where all of my simulators disappeared. In Xcode the canvas would only show a preview for the macOS build and I had no option to preview for any other Apple platform.

The “Devices and Simulator” window was completely empty. The target platforms and simulators are listed as installed in Settings->Components screen in Xcode’s settings.

On the command line, we can confirm this by running xcrun simctl list. Here we see that there are no devices available.