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

如何修复iOS/Xcode构建错误:未定义符号__C.NSURLSession.DataTaskPublisher?

Understanding and Fixing "Undefined symbols for architecture x86_64" with Combine's DataTaskPublisher

Let's break down what this error means and walk through actionable fixes for your React Native Xcode project:

What This Error Means

The linker is failing because it can't find critical symbols related to NSURLSession.DataTaskPublisher—a Combine framework extension built into Foundation. These missing symbols include:

  • Type metadata for the DataTaskPublisher type
  • Protocol conformance descriptors for DataTaskPublisher conforming to Combine.Publisher
  • The dataTaskPublisher(for:) method that instantiates the publisher

Your dependency libTinyNetworkingObjcIO.a relies on these Combine APIs, but your project isn't properly linking the Combine framework, or there's a mismatch in build configurations between your main project and the CocoaPods dependencies.

Fixes to Try

1. Ensure Combine Framework is Linked Everywhere

  • Open your Xcode project, select your main React Native target, navigate to Build Phases > Link Binary With Libraries. Check if Combine.framework is listed—if not, click the + button to add it.
  • For your CocoaPods dependency, add explicit linking to Combine in your Podfile using a post-install hook:
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        if target.name == 'TinyNetworkingObjcIO'
          target.build_configurations.each do |config|
            config.build_settings['OTHER_LDFLAGS'] += ' -framework Combine'
          end
        end
      end
    end
    
    Run pod install again after updating the Podfile.

2. Align Architecture Settings

  • Verify that your main project and all Pod targets use matching architecture settings. Go to Build Settings > Architectures and ensure ARCHS is set to $(ARCHS_STANDARD) (which includes x86_64 for simulator builds) for all targets.
  • If your project still uses VALID_ARCHS (common in older Xcode versions), make sure x86_64 is included in this list for both the main project and Pods.

3. Clean Build Caches

  • Clear Xcode's build cache with Cmd+Shift+K, then delete your Derived Data folder (find it via Xcode > Preferences > Locations > Derived Data).
  • Deintegrate and reinstall your Pods to eliminate stale build files:
    pod deintegrate
    pod install
    

4. Verify Deployment Target Compatibility

  • Combine requires iOS 13.0 or later. Check that your main project's deployment target and the TinyNetworkingObjcIO Pod's deployment target are both set to iOS 13.0 or higher. Adjust this in Build Settings > Deployment Target.
  • If the Pod has a lower deployment target, update it in the Podfile or check for a newer version of the library that supports iOS 13+.

5. Switch to Dynamic Frameworks (If Needed)

  • If your project uses static linking by default, try switching to dynamic frameworks in your Podfile:
    use_frameworks! :linkage => :dynamic
    
    Run pod install again—dynamic frameworks automatically handle framework dependencies like Combine, which can resolve linking issues.

内容的提问来源于stack exchange,提问作者August Lilleaas

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.08 08:52:31