Export Localization builds with macOS causing trouble: requires minimum platform version

I got a project that I am developing for iOS only with a local Swift package that I want to localize, so I added the Resources dir and added a defaultLocalization line in the Package.swift. That local package has a dependency on GRDBQuery.

Now when I want to export the localized strings, I get this error:

enter image description here

I don't even use macOS in the Entities package:

enter image description here

This is a really annoying error. Does anyone know how to fix it? I can NOT add macOS as a target. Why does it say 'this target supports 10.13'?

I can localize my main target fine when my local package does NOT use localization. As soon as it does, I see in the logging that it uses macOS to build. When the local packages do not have localization, iOS SDK is used.

The platforms entry can easily be misunderstood. Only the restrictions are listed inside the platforms entry. (To my knowledge, you still cannot exclude platforms, see e.g. this older topic.) You do not have any listed restriction for macOS. When you use a package, you have to consider all platform restrictions of the package. Just add an according restriction for macOS and you should be fine.

According to the screenshot, you are building the Entities target for macOS, maybe that's the root issue here? Also curious to see "Destination (null)".

Hmmm, I don't understand this answer. 'Only the restrictions are listed inside the platforms entry.' How do you mean? The platform section is the supported platform section right?

'Just add an according restriction for macOS and you should be fine.' How would I do that?

I didn't do that, Xcode does that somehow automatically when there is a local package which can be localized, I checked that.

The whole problem is that it builds with macOS, I don't want that, my app does not support that. I think it is odd Xcode decides to build it with macOS.

The entry platforms: [.iOS(.v16),] says to you have a restriction for iOS, but there is no restriction for any other platform. So I would think that platforms: [.iOS(.v16), macOS(.v10_15),] would save you.

You mean that you cannot add macOS(.v10_15) in the platforms entry?

No I can not add that, that will mean I have to wrap a lot of code inside #if IOS, something I don't really want to do

Well, I think for for an iOS app you should use the according Xcode project format and not a project for the Swift Package Manager, or has this changed? Can anyone else help with this? ... (Sorry, I do not do iOS apps so I maybe I did not see the main problem here.)

Ofcourse you can use SPM with an iOS Xcode project. The main problem is: I use UIKit in almost every file. I can not simply say: I use macOS now, that causes hundreds of compile errors. If Xcode would just build with iOS there would be no problem

So this is happening when using Product => Export Localizations and choosing the overarching iOS project or only when specifically choosing the local package?

What you did not understand is that adding macOS(.v10_15) does not introduce a new target, it just restricts the macOS version when targeting macOS. If you do not mention macOS in the platforms entry, macOS is not (!) excluded.

For both it will build with macOS.

Look for platform target settings within Xcode (not in Package.swift).

Aaah, alright, thanks for the clarification. It would probably work when I add the macOS version to the platform with the correct version and build with iOS. But if I add the version for macOS, I got error that UIKit is not available on macOS. This is the main problem: Xcode decides to build with macOS. My whole app is not designed for macOS, so this gives a lot of errors.

See my last comment. May this helps.

I checked it, it is iOS only

So I guess better use the Xcode project format for an iOS project. In such a project you can then add packages that are realized for the Swift Package Manager.