"'value' is Unavailable: Introduced in iOS 12.0" Xcode Error in React Native

royged

Oluwaseyi Komolafe

Posted on January 21, 2024

"'value' is Unavailable: Introduced in iOS 12.0" Xcode Error in React Native

When working with React Native on iOS, you might encounter an error message like "'value' is unavailable: introduced in iOS 12.0." This issue arises when the deployment target specified in your project conflicts with the version of iOS you are trying to run your application on. In this quick guide, we'll explain the cause of this problem and provide a solution to fix it. You can just scroll down to the end if you are here for the solution though.

The Error

The error usually occurs when your React Native project's minimum deployment target is set to a version lower than the iOS version you are using for development. This discrepancy can lead to compatibility issues with certain APIs or features introduced in later iOS versions.

The Fix

To address this error, you can adjust the deployment target in your project's Podfile. The Podfile is a configuration file used by CocoaPods, a dependency manager for Swift and Objective-C projects.

Here's a step-by-step breakdown of the fix:

  1. Set the iOS Version: Open your Podfile and add the following lines to set the iOS version:
   IOS_VERSION = '12.4'
Enter fullscreen mode Exit fullscreen mode
  1. Adjust Build Configurations: Inside the post_install block, iterate through the build configurations and set the deployment target:
   installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = IOS_VERSION
       config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
       config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
     end

     # Special case for 'RCT-Folly'
     case target.name
     when 'RCT-Folly'
       target.build_configurations.each do |config|
         config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
       end
     end
   end
Enter fullscreen mode Exit fullscreen mode

These adjustments ensure that the deployment target is set to iOS 12.4, excluding unnecessary architectures, and using only the active architecture.

  1. Run CocoaPods Install: After modifying your Podfile, run the following command in your project's root directory:
   pod install
Enter fullscreen mode Exit fullscreen mode

This command installs the specified CocoaPods dependencies and updates your project configuration.

Conclusion

By adjusting the iOS deployment target in your Podfile, you resolve the compatibility issue causing the "'value' is unavailable: introduced in iOS 12.0" error. This quick fix ensures your React Native project aligns with the iOS version you are developing for, allowing you to leverage the latest features and APIs seamlessly.

Happy coding! ๐Ÿš€

๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
royged
Oluwaseyi Komolafe

Posted on January 21, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

ยฉ TheLazy.dev

About