You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native 0.60.3适配Xcode9.4编译报错,求支持性判断与解决方案

Hey there! Let's tackle your React Native iOS build issue step by step:

Xcode 9.4 Support for React Native 0.60.3

First off, let's clarify the support situation: React Native 0.60.x officially requires Xcode 10.0 or newer. The error you're seeing ties directly to this—RN 0.60 started leveraging iOS SDK features (like UIUserActivity, which is part of iOS 12's SDK) that aren't included or fully supported in the older iOS 11.4 SDK bundled with Xcode 9.4. While you might cobble together a workaround, Xcode 9.4 isn't a supported environment for this RN version, and you'll likely run into more compatibility hurdles down the line.

Fixes for the UIKit/UIUserActivity.h Not Found Error

Option 1: Upgrade Xcode to 10.0+ (Highly Recommended)

This is the cleanest and most reliable solution, as it aligns with React Native's official requirements. Here's what to do:

  • Open the Mac App Store, search for Xcode, and update to a version 10.0 or newer (note: newer Xcode versions may require a more recent macOS release, so double-check compatibility first).
  • After updating, launch Xcode and accept any license agreements or component installation prompts that pop up.
  • Try re-running react-native run-ios, or open your ProjectN.xcworkspace directly in Xcode and build from there to confirm the fix.

Option 2: Workaround for Xcode 9.4 (Not Ideal, But Possible)

If upgrading Xcode isn't an option right now, you can try this workaround—just keep in mind it might introduce other compatibility issues later:

  1. Open your project's ios/Podfile in a text editor.
  2. Add this post-install hook at the bottom of the file:
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        if target.name == 'React-RCTLinking'
          target.build_configurations.each do |config|
            config.build_settings['HEADER_SEARCH_PATHS'] ||= []
            config.build_settings['HEADER_SEARCH_PATHS'] += ['$(SDKROOT)/System/Library/Frameworks/UIKit.framework/Headers']
          end
        end
      end
    end
    
  3. Run pod install from your project's ios directory to apply the changes.
  4. Clean your Xcode build folder (press Cmd+Shift+K in Xcode) and attempt to build again.

One extra check: Ensure your project's iOS deployment target is set to iOS 11.0 or higher (React Native 0.60 requires this). You can adjust this in your ProjectN.xcworkspace under the project's general settings.

内容的提问来源于stack exchange,提问作者walid sahli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 06:48:13