Target is null when adding an extension (Device Activity Monitor Extension)

When I try to add an extension to my Xcode project, I get the following warning:

Activate “MyMonitor” scheme? This scheme has been created for the “(null)” target. Choose Activate to use this scheme for building and debugging. Schemes can be chosen in the toolbar or Product menu.

I'm trying to understand a few things about this error:

  1. What exactly does the "(null)" target refer to? Could it be that Xcode is creating the scheme before the target is complete?
  2. Could this "(null)" target be the reason my code doesn't seem to be connecting properly to my app extension?
  3. How can I correct this issue?

I ran into this during the process of trying to add a Device Activity Monitor Extension to my iOS project.

Any hints are welcome, I have been stuck on this for too long.

Any luck?

I hit this in Xcode 15 Beta 8 (also 14.3.1 (14E300c)) when trying to add a NotificationServiceExtension Target to my App/Project. This "(null)" target occurs regardless of my Deployment target (tried iOS 16.0 and 17.0). It's my top candidate as the root cause for why my NotificationServiceExtension will not attach, print anything to console, nor hit a breakpoint.

Other tactics I tried:

  1. Ensuring the iOS deployment target and marketing version is the same for app/NotificationServiceExtension
  2. Adding AppGroup capability to the NotificationServiceExtension and configuring for each buildEnv
  3. Adding PN capability to the NotificationServiceExtension
  4. Ensuring the bundleId stem of the NotificationServiceExtension matches the app

No luck unfortunately :( Any help is appreciated!

Same Question:

This scheme has been created for the “(null)” target. Choose Activate to use this scheme for building and debugging. Schemes can be chosen in the toolbar or Product menu.

This problem caused the app extension not working.

I used Xcode on another mac to create the app extesion and solve this problem.

But not a good idea..

Any updates? I'm having the same issue when adding a widget and cannot make it work due to this I believe

I'm developing a live activity, and I had the same problem. I solved it by compiling the widget target before using it in the main target. You should try this in case the extension is unavailable in the main target. @hapiii @JeromeMF @philippnoah @turtlenerd

Another scenarie maybe be when the target membership of main target is unselected, for example:

When i created the extension, by default the main target comes unselect, after turn selected works

Target is null when adding an extension (Device Activity Monitor Extension)
 
 
Q