Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 15.0: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. #1379

Closed
sbarber2 opened this issue Oct 12, 2023 · 16 comments

Comments

@sbarber2
Copy link

Bug Report

cordova-lib doesn't directly support Xcode 15.0's minimum target deployment version of 12.0

Problem

Using cordova-lib 12.0.1 with XCode 15.0:

/Users/xxxx/cordova_apps/hello/platforms/ios/CordovaLib/CordovaLib.xcodeproj The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99.

What is expected to happen?

When using XCode 15.0, the IPHONEOS_DEPLOYMENT_TARGET is at least 12.0.

What does actually happen?

When using XCode 15.0, the IPHONEOS_DEPLOYMENT_TARGET is at 11.0, and this causes build errors and/or warnings.

For example:

/Users/xxxx/cordova_apps/xcode15test/platforms/ios/HelloCordova.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'HelloCordova' from project 'HelloCordova')
/Users/xxxx/cordova_apps/xcode15test/platforms/ios/CordovaLib/CordovaLib.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'CordovaLib' from project 'CordovaLib')

These are just warnings in the build that occurs using the commands below, but in more complicated builds this version mismatch has caused an error and a failed build.

Information

This is all on MacOS Ventura 13.6.

Command or Code

Install XCode 15.0 or higher
Bring up a Terminal

mkdir cordova_apps
cordova create xcode15test
cd xcode15test
cordova add platform iOS
cordova build iOS

Environment, Platform, Device

This is all on MacOS Ventura 13.6. The machine is a MacBook Air M1.

Version information

Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins

cordova --version
12.0.0 ([email protected])

No plugins

MacOS Ventura 13.6
XCode 15.0

Checklist

  • [x ] I searched for existing GitHub issues
  • [x ] I updated all Cordova tooling to most recent version
  • [ x] I included all the necessary information above
@breautek breautek transferred this issue from apache/cordova-lib Oct 12, 2023
@breautek
Copy link
Contributor

cordova-lib is the cordova shared JS library, so I moved this ticket to the more appropriate repo for you.

but in more complicated builds this version mismatch has caused an error and a failed build.

Can you elaborate more on this? Personally I pushed to bump the minimum deployment target for cordova-ios 7 release, but the community kind of voted against it because it was just a warning... and instead favoured to use the lowest deployment target possible. :\

I think you can use the deployment-target preference to override it, so that might also be a workaround for the time being.

@dpogue
Copy link
Member

dpogue commented Oct 12, 2023

This is just a warning and can be ignored.

As Norman mentions, you can set <preference name="deployment-target" value="12.0" /> in config.xml to force a specific deployment target

@sbarber2
Copy link
Author

sbarber2 commented Oct 12, 2023 via email

@breautek
Copy link
Contributor

reporting about something that maybe means something to an XCode user, but doesn't point explicitly back to the relevant cordova-ios
deployment-target preference.

The warning comes from XCode. It's part of the native iOS project which has nothing to do with Cordova (from Apple's perspective). So naturally it's not going to provide details to what Cordova may have to configure the project.

@mpmontanez
Copy link

@sbarber2 Did you find that setting the "deployment-target" preference did update the IPHONEOS_DEPLOYMENT_TARGET setting in CordovaLib.xcodeproj? For me, setting that preference doesn't seem to change the CordovaLib target.

@dpogue
Copy link
Member

dpogue commented Nov 15, 2023

setting that preference doesn't seem to change the CordovaLib target.

I don't think it will affect the CordovaLib project, it only applies to the application project

@sc0ttdav3y
Copy link

Hi there!

I've got this as well, and I'm hoping someone with more brains than I can kindly point me in the right direction?

In my case, I run:

cordova build ios --debug

and I get:

/app/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target
'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment 
target versions is 12.0 to 17.2.99. (in target 'XXXXXX' from project 'Pods')

where XXXXXX is repeated for a bunch of low-level pods. The pod names seem to be a dependency of a dependency so I'm not sure what they are, but I can see that one of them is 'CordovaLib' from project 'CordovaLib' but there are many more as well.

In my config.xml I have set <preference name="deployment-target" value="15.0" />, and I can see the generated Podfile has this in it, so it appears to be honouring the preference:

# DO NOT MODIFY -- auto-generated by Apache Cordova
source 'https://cdn.cocoapods.org/'
platform :ios, '15.0'
use_frameworks!
target 'MyApp' do
	project 'MyApp.xcodeproj'
	pod 'CocoaLumberjack', '~> 3.7.2'
	pod 'MLKitTextRecognition'
end

I'm not entirely sure what Cordova does under the hood beyond that, but I can see in XCode it shows iOS 11
as the deployment target despite the Podfile and the preference:

Screenshot 2023-12-20 at 4 32 21 pm

Any help from the cordova-ios brains trust to point me in the right direction would be appreciated!

Also, love your work and thanks!

@sc0ttdav3y
Copy link

This further info may help.

If I search for IPHONEOS_DEPLOYMENT_TARGET in platforms/ios, it shows a mix of targets in the Pods project:

Screenshot 2023-12-20 at 5 01 11 pm

I spotted this warning as well:

The `My App [Release]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-My App/Pods-My App.release.xcconfig'. This can lead to problems with the CocoaPods installation

Unfortunately for me, coming from a web developer background, so I'm a bit like that meme where I don't know what pods are and at this point I'm too afraid to ask :-)

Through trial and error I found a plugin that was causing this (for me it was plugin-cordova-ml-text).

My mental model is that the plugin was referencing pods that had lower build targets. Interestingly, I still see some lower numbered deployment targets in the Podfile (down to 9.0) and in CordovaLib (down to 11.0) after removing that plugin, but my project compiles now.

Here's my same search afterward in case (less bad targets but still some):

Screenshot 2023-12-20 at 6 11 36 pm

I'm not sure if this is a problem with cordova-ios or not — I don't quite understand it all — but TL;DR from me is to remove your plugins one by one until it works. 🤷🏻

@julfrechette
Copy link

julfrechette commented Feb 16, 2024

Xcode 15 will be mandatory to build apps which can be submitted to the App Store:

Please note that as of April 2024 all iOS and iPadOS apps submitted to the App Store must be built with a minimum of Xcode 15 and the iOS 17 SDK.

Currently, the MyProject deployment minimum version can be updated using:
<preference name="deployment-target" value="12.0" />

However this does not apply to CordovaLib.xcodeproj which triggers the a similar build error:

***/platforms/ios/CordovaLib/CordovaLib.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'CordovaLib' from project 'CordovaLib')

Is there another preference which can be applied to all .xcodeproj dependencies generated in the iOS platform and not just MyProject?

All other alternatives which require to manually edit the project files will force us to update our CI/CD workflows which are currently generating the iOS and Android platforms from scratch.

(For best practice, we only commit the Cordova project to our repo, not the files generated at build time)

@dpogue
Copy link
Member

dpogue commented Feb 17, 2024

However this does not apply to CordovaLib.xcodeproj which triggers the a similar build error:

***/platforms/ios/CordovaLib/CordovaLib.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'CordovaLib' from project 'CordovaLib')

This is not an error, it is only a warning and can be ignored

@ChiragMoradiya
Copy link

We also encountered the same warning. We planned to ignore it for now as @dpogue suggested.

@erisu
Copy link
Member

erisu commented Mar 9, 2024

I will close out this ticket as it is only a warning message and shouldn't cause failures with builds or app store submissions.

@erisu erisu closed this as completed Mar 9, 2024
@connyhald
Copy link

This issue may result in a warning or in an error like in this case:

clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a'; try increasing the minimum deployment target

** ARCHIVE FAILED **

Increasing the IPHONEOS_DEPLOYMENT_TARGET of the lib helps here but it looks like we can only set it using Xcode and not as configuration which would be needed for CI/CD, etc...

@amcalgates
Copy link

@erisu - this is not just a warning if you're using Xcode 15, and per @julfrechette's comment, we are all going to be forced to use it this month.

In my case this build error (which prevents compilation and is not just a warning) is due to plugins I'm using that bring in Cocoapods that have their deployment target set to a version <12.

This is a problem outside of Cordova as well. For my native apps I've solved the problem by appending this to my Podfile:

post_install do |installer|
    installer.generated_projects.each do |project|
        project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
            end
        end
    end
end

As seen here and in many other SO answers.

A temporary workaround to get my Cordova apps to build is to go into Xcode and manually change the deployment target of each offending pod target. However, these changes are all nuked every time I run cordova build ios.

Is there some way for cordova-ios users to modify the Podfile? It seems there is, but that that is also broken? As I have this in my config.xml:

<preference name="deployment-target" value="12.0" />

I really think this issue should be re-opened.

@connyhald
Copy link

We solved this using a rather ugly (but working) hack using the following script to post-process the project files.

const fs = require('fs');
const path = require('path');

function findFilePathsByFilename(directory, filename) {
	const files = fs.readdirSync(directory);
	const filePaths = [];

	for (const file of files) {
		const filePath = path.join(directory, file);
		const stats = fs.statSync(filePath);

		if (stats.isDirectory()) {
			// Recursively search in subdirectories
			const subdirectoryFilePaths = findFilePathsByFilename(filePath, filename);
			filePaths.push(...subdirectoryFilePaths);
		} else if (stats.isFile() && file === filename) {
			// If the file matches the filename, add its path to the result
			filePaths.push(filePath);
		}
	}
	return filePaths;
}


const paths1 = findFilePathsByFilename('.', 'project.pbxproj');
const paths2 = findFilePathsByFilename('.', 'Pods.xcodeproj');
const paths = paths1.concat(paths2)

console.log('Apply patch to', paths);

for (let path of paths) {
	let content = fs.readFileSync(path, { encoding: 'utf-8' });
	content = content.replace(/IPHONEOS_DEPLOYMENT_TARGET = [0-9]+.0;/g, 'IPHONEOS_DEPLOYMENT_TARGET = 12.0;');
	fs.writeFileSync(path, content);
}

console.log('Done setting IPHONEOS_DEPLOYMENT_TARGET');

@pixeled
Copy link

pixeled commented Jun 17, 2024

why is this "closed", since following all the "current"? documentation in https://cordova.apache.org/docs/en/12.x/guide/cli/index.html causes this, and it's not "just a warning" as you get ** ARCHIVE FAILED ** - so - following current directions with an up to date system, just doesn't work.

don't you guys dog food your system?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests