Closed orzhtml closed 1 year ago
Same issue here. I'm also using Xcode 12.4 - Could that be the reason?
+1
My system: macOS Catalina (10.15.7) MacBook Pro (13-inch, Mid 2012)
Xcode Version:12.4 (12D4e)
The latest system cannot be upgraded,Could that be the reason?
same issue, please give me solution when u have. tks
Same with me macOS Catalina (10.15.7) Xcode Version:12.4 (12D4e)
Same issue,
macOS Catalina (10.15.7) Xcode Version:12.4 (12D4e)
+1
change the pod files line number 31-37 as (comment this line) use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h
end
search IPHONEOS_DEPLOYMENT_TARGET in the whole project and change to 12.4 for every pod as well
hope that works.....
I have the same problem. I think the error is that the app runs iOS 14.4
Here's how I fixed it:
node_modules/react-native/scripts/react_native_pods.rb
'ios' => '11.0',
11.0
to 12.0
patch-package
to make a patch.ios/build/generated/ios/React-Codegen.podspec.json
and confirm "platforms": { "ios": "12.0" }
That's all.
diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index 7f6ebab..cea0fef 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -398,7 +398,7 @@ def get_react_codegen_spec(options={})
'source' => { :git => '' },
'header_mappings_dir' => './',
'platforms' => {
- 'ios' => '11.0',
+ 'ios' => '12.0',
},
'source_files' => "**/*.{h,mm,cpp}",
'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
this worked, on a brand new project. Ive yet to add packages to see if those run fine. but can you please explain your line of thinking/workflow that made you come to this solution?
edit: after installing packages, project kept on reverting to 11.0. still unable to find a solution
4. Use
patch-package
to make a patch.
npx patch-package react-native
+1
I'm getting this on a brand RN new project following the Getting Started instructions. Seems pretty ridiculous we'd have to modify one of the node_module files.
@craspadotcom You have to add the postinstall script in package.json so it patches the files when you install/update packages.
"scripts": {
"postinstall": "patch-package",
},
The error occurs because React Native 0.69 targets ios 12.4 in Podfile but the Codegen generated podspec still targets ios 11.0 while using ios 12+ apis. I think there should be a patch release that fixes this issue.
This fix worked for me
In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj
Change all the 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' to 'IPHONEOS_DEPLOYMENT_TARGET = 12.4'. save and run.
Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.
In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj
Change all the 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' to 'IPHONEOS_DEPLOYMENT_TARGET = 12.4'. save and run.
Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.
this was helpful my issue was resolved using this
In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj
Change all the 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' to 'IPHONEOS_DEPLOYMENT_TARGET = 12.4'. save and run.
Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.
Thanks for this. After so many tries on how to resolve this issue, this is the one that worked. 🍻
Update for version 0.70.3: If you want to follow advice from @ammarahm-ed , the property is in a different file now:
diff --git a/node_modules/react-native/scripts/cocoapods/codegen_utils.rb b/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
index 6fcbb15..7e457b9 100644
--- a/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
+++ b/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
@@ -84,7 +84,7 @@ class CodegenUtils
'source' => { :git => '' },
'header_mappings_dir' => './',
'platforms' => {
- 'ios' => '11.0',
+ 'ios' => '12.0',
},
'source_files' => "**/*.{h,mm,cpp}",
'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
+1
I had the same issue. Advice from @sesm worked for me
In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj
Change all the 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' to 'IPHONEOS_DEPLOYMENT_TARGET = 12.4'. save and run.
Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.
You saved my job man! I know this is because our old macs are not updating to the latest ios. Now i hope i earn enough to buy the new mac :)
@ammarahm-ed 's and @sesm 's solution helped me as well. Thank you!
@OmarUsman777
I think If you set like this in Podfile, you don't have to change them manually everytime.
...
post_install do |installer|
react_native_post_install(
installer,
# Set `mac_catalyst_enabled` to `true` in order to apply patches
# necessary for Mac Catalyst builds
:mac_catalyst_enabled => false
)
# NOTE: Change IPHONEOS_DEPLOYMENT_TARGET to 12.4.
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
end
end
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj
Change all the 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' to 'IPHONEOS_DEPLOYMENT_TARGET = 12.4'. save and run.
Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.
Thank you so much. You saved my day.
Thank you very much. The below fix worked for me too, I am still in the old XCode Version 12.4.
Change all the 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' to 'IPHONEOS_DEPLOYMENT_TARGET = 12.4'. save and run.
This is happening with Xcode Cloud when you have Xcode set to 14.3RC, if you change it to 14.2 you are good to go.
I wonder if this is due to changes in Swift 5.8.
This is happening to me on XCode 14.2 as well since 2 days ago
This solution worked for me with Xcode 14.3RC
To anyone that keeps having these issues and is using XcodeCloud, make sure to go to the workflow settings and choose the correct environment. In my case it was using the latest environment (14.3RC at the moment) and that was breaking everything. I selected spewcifically 14.2 and multiple things got fixed.
Can confirm this happens in Xcode 14.3. I downloaded RC2 today and this issue started. I was able to solve it by the following:
Pods
.React-Codegen
and set the window to Build Settings
.iOS Deployment Target
to 12.4
.Can confirm this happens in Xcode 14.3. I downloaded RC2 today and this issue started. I was able to solve it by the following:
1. In your Xcode project navigator, select `Pods`. 2. Under Targets, select`React-Codegen` and set the window to `Build Settings`. 3. Under Deployment, set `iOS Deployment Target` to `12.4`. 4. Clean project and rebuild.
This almost worked for me.
I also had to update the build targets for react-native-quick-crypto
and react-native-quick-base64
.
So if anyone relies on these dependencies as well, those need to be bumped.
Thanks
Can confirm this happens in Xcode 14.3. I downloaded RC2 today and this issue started. I was able to solve it by the following:
1. In your Xcode project navigator, select `Pods`. 2. Under Targets, select`React-Codegen` and set the window to `Build Settings`. 3. Under Deployment, set `iOS Deployment Target` to `12.4`. 4. Clean project and rebuild.
This almost worked for me. I also had to update the build targets for
react-native-quick-crypto
andreact-native-quick-base64
. So if anyone relies on these dependencies as well, those need to be bumped.
Thanks man, you saved my day!
Do you know how this can be solved in Expo Managed Workflow? I added expo-build-properties
plugin to increase the iOS Deployment Target to 13.0 but it didn't solve the issue. Still getting the 'value' is unavailable: introduced in iOS 12.0
issue.
[ 'expo-build-properties', { ios: { deploymentTarget: '13.0', }, }, ],
Why was this issue closed? @orzhtml can you please reopen since it isn't fixed
This solution worked for me with Xcode 14.3RC
This work for me
Here's an expo config plugin that worked for me for managed Expo workflow (it updates the deployment target for all pods to 13.0)
/* eslint-disable @typescript-eslint/no-var-requires */
const { withDangerousMod, withPlugins } = require("@expo/config-plugins");
const {
mergeContents,
} = require("@expo/config-plugins/build/utils/generateCode");
const fs = require("fs");
const path = require("path");
async function readFileAsync(path) {
return fs.promises.readFile(path, "utf8");
}
async function saveFileAsync(path, content) {
return fs.promises.writeFile(path, content, "utf8");
}
const withFixedDeploymentTarget = (c) => {
return withDangerousMod(c, [
"ios",
async (config) => {
const file = path.join(config.modRequest.platformProjectRoot, "Podfile");
const contents = await readFileAsync(file);
await saveFileAsync(file, fixDeploymentTarget(contents));
return config;
},
]);
};
function fixDeploymentTarget(src) {
return mergeContents({
tag: `rn-fix-deployment-target`,
src,
newSrc: `
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
`,
anchor: /post_install/,
offset: 1,
comment: "#",
}).contents;
}
module.exports = (config) => withPlugins(config, [withFixedDeploymentTarget]);
Put this in "
Then add to your app.json
:
{
"plugins": ["./config-plugins/deployment-targets"]
}
Then rm -rf ios
=> expo run:ios
Do you know how this can be solved in Expo Managed Workflow? I added
expo-build-properties
plugin to increase the iOS Deployment Target to 13.0 but it didn't solve the issue. Still getting the'value' is unavailable: introduced in iOS 12.0
issue.[ 'expo-build-properties', { ios: { deploymentTarget: '13.0', }, }, ],
That's cool if you use Expo. Our project doesn't however, so other workarounds are needed.
Can confirm this happens in Xcode 14.3. I downloaded RC2 today and this issue started. I was able to solve it by the following:
- In your Xcode project navigator, select
Pods
.- Under Targets, select
React-Codegen
and set the window toBuild Settings
.- Under Deployment, set
iOS Deployment Target
to12.4
.- Clean project and rebuild.
Thank you this worked perfectly!
Here's an expo config plugin that worked for me for managed Expo workflow (it updates the deployment target for all pods to 13.0)
/* eslint-disable @typescript-eslint/no-var-requires */ const { withDangerousMod, withPlugins } = require("@expo/config-plugins"); const { mergeContents, } = require("@expo/config-plugins/build/utils/generateCode"); const fs = require("fs"); const path = require("path"); async function readFileAsync(path) { return fs.promises.readFile(path, "utf8"); } async function saveFileAsync(path, content) { return fs.promises.writeFile(path, content, "utf8"); } const withFixedDeploymentTarget = (c) => { return withDangerousMod(c, [ "ios", async (config) => { const file = path.join(config.modRequest.platformProjectRoot, "Podfile"); const contents = await readFileAsync(file); await saveFileAsync(file, fixDeploymentTarget(contents)); return config; }, ]); }; function fixDeploymentTarget(src) { return mergeContents({ tag: `rn-fix-deployment-target`, src, newSrc: ` installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '5.0' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end `, anchor: /post_install/, offset: 1, comment: "#", }).contents; } module.exports = (config) => withPlugins(config, [withFixedDeploymentTarget]);
Put this in "
/config-plugins/deployment-targets.js" Then add to your
app.json
:{ "plugins": ["./config-plugins/deployment-targets"] }
Then
rm -rf ios
=>expo run:ios
Working for me! I like the fix
Do you have a edit that will only update the react-native codegen package, updating all of them seems a error prone?
@shoopapa I haven't tried to do it just with the one package but maybe can add an if statement in there to check for the package name? I'm not really well versed in pod file syntax. probably better to do it for just react native codegen but doing it this way seems to be fine so far
Can confirm this happens in Xcode 14.3. I downloaded RC2 today and this issue started. I was able to solve it by the following:
- In your Xcode project navigator, select
Pods
.- Under Targets, select
React-Codegen
and set the window toBuild Settings
.- Under Deployment, set
iOS Deployment Target
to12.4
.- Clean project and rebuild.
Thank you, it works perfectly for me.
Here's how I fixed it:
- Open
node_modules/react-native/scripts/react_native_pods.rb
- Go to line no 401 >>>
'ios' => '11.0',
- Change
11.0
to12.0
- Use
patch-package
to make a patch.- Run yarn
- Run pod install
- Go to
ios/build/generated/ios/React-Codegen.podspec.json
and confirm"platforms": { "ios": "12.0" }
That's all.
diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb index 7f6ebab..cea0fef 100644 --- a/node_modules/react-native/scripts/react_native_pods.rb +++ b/node_modules/react-native/scripts/react_native_pods.rb @@ -398,7 +398,7 @@ def get_react_codegen_spec(options={}) 'source' => { :git => '' }, 'header_mappings_dir' => './', 'platforms' => { - 'ios' => '11.0', + 'ios' => '12.0', }, 'source_files' => "**/*.{h,mm,cpp}", 'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
The same issue happened to me in new Xcode 14.3. That's save me! Thanks! ❤️
@iway1 This works for me, updating all the pods isn't necessary
const { withDangerousMod, withPlugins } = require("@expo/config-plugins");
const { ExpoConfig } = require("@expo/config-types");
const {
mergeContents,
} = require("@expo/config-plugins/build/utils/generateCode");
const { readFileSync, writeFileSync } = require("fs");
const { resolve } = require("path");
const withFixedDeploymentTarget = (c) => {
return withDangerousMod(c, [
"ios",
async (config) => {
const file = resolve(config.modRequest.platformProjectRoot, "Podfile");
const contents = readFileSync(file, { encoding: "utf-8" });
writeFileSync(file, fixDeploymentTarget(contents));
return config;
},
]);
};
function fixDeploymentTarget(src) {
return mergeContents({
tag: `rn-fix-deployment-target`,
src,
newSrc: `
installer.pods_project.targets.each do |target|
if target.to_s === 'React-Codegen'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
`,
anchor: /post_install/,
offset: 1,
comment: "#",
}).contents;
}
module.exports = (config) => withPlugins(config, [withFixedDeploymentTarget]);
Here is edit for only patching React-Codegen
At least temporarily, I recommend this solution if using expo, manually editing the podfile isn't optimal in the expo workflow
@shoopapa nice - I also strongly recommend not manually editing any native files at all with expo managed workflow, it's a really big advantage to be able to not care about the ios/android folders and to be able to regenerate them easily.
I have this problem after updating xcode from version 14.2 to 14.3. The above solution does the trick, but it's very annoying to have to do this every time you run pod-install. Has anyone found a permanent solution to this problem?
This solution worked for me with Xcode 14.3RC
This worked like magic.
test your fix on build with hermes and fabric enabled
Description
'value' is unavailable: introduced in iOS 12.0
Version
0.69.0
Output of
npx react-native info
System: OS: macOS 10.15.7 CPU: (4) x64 Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz Memory: 27.26 MB / 8.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v14.17.0/bin/yarn npm: 8.4.1 - ~/.nvm/versions/node/v14.17.0/bin/npm Watchman: 4.7.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 23, 25, 26, 27, 28, 29, 30 Build Tools: 26.0.2, 26.0.3, 28.0.3, 29.0.2, 29.0.3, 30.0.3 System Images: android-25 | Google APIs ARM EABI v7a, android-29 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7351085 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 1.8.0_152 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.0 => 0.69.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
npx react-native init example --template react-native-template-typescript
yarn start
open xcode run
Snack, code example, screenshot, or link to a repository