We are building an app that support Mac Catalyst and network extension is included in.
We don't know why the compiler throw this error:
Network extensions are not available when building for Mac Catalyst.
The documentation related to network extensions (in this case NEFilterDataProvider) in apple docs said explicitly that Mac catalyst is available.
@eskimo @meaton please let me know if there's a bug with it.
https://developer.apple.com/documentation/networkextension/nefilterdataprovider
The documentation related to network extensions (in this case NEFilterDataProvider) in apple docs said explicitly that Mac catalyst is available. @eskimo @meaton please let me know if there's a bug with it.
This is not a bug. This is intentional to let you know that creating a provider for Mac Catalyst does not work as you would expect because you need to create a Network System Extension, and not a Network App Extension on macOS.
The symbols are in the documentation because they are available in Mac Catalyst. It would be worth a bug report to update the documentation for this.
If you want to target both plaforms, one course of action would be to add two targets, one for iOS and one for macOS to your Xcode project. The macOS route would instantiate a Network System Extension and then the iOS route would instantiate a Network App Extension. Then, there would be a group in the project that contains all of the shared code for your business needs that can be added to both targets. This is not the greatest solution because you end up maintaining and deploying two targets instead of one, but it should let you get off the ground in the immediate future.