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

含vendored_framework的CocoaPod无法链接内部依赖框架的问题

Fixing "SNAPSDK.h Not Found" Error in Vendored Frameworks Pod

Hey there, I’ve run into this exact issue before when packaging multiple dependent frameworks into a single CocoaPod—let’s walk through how to fix it step by step.

Root Cause

When you include both SNAPSDK and IVA as vendored_frameworks in your MyPod spec, CocoaPods doesn’t automatically set up the dependency link between them. Even if you added search paths in IVA’s standalone project, those settings don’t carry over when the framework is embedded via your Pod.


Step 1: Update Your Podspec to Explicitly Define Dependencies & Search Paths

The key is to tell CocoaPods about the relationship between the two frameworks and ensure IVA can find SNAPSDK’s headers at compile time. Here’s how to adjust your MyPod.podspec:

Pod::Spec.new do |s|
  s.name = 'MyPod'
  s.version = '1.0.0'
  s.summary = 'Your custom pod with multiple vendored frameworks'
  s.homepage = 'Your project homepage'
  s.license = { :type => 'MIT', :file => 'LICENSE' }
  s.author = { 'Your Name' => 'your@email.com' }
  s.source = { :git => 'Your repo URL', :tag => s.version.to_s }

  # Specify the path to your stored frameworks (adjust to match your actual folder structure)
  s.vendored_frameworks = 'Frameworks/SNAPSDK.framework', 'Frameworks/IVA.framework'

  # Explicitly declare IVA's dependency on SNAPSDK (use :podspec => false for local frameworks)
  s.dependency 'SNAPSDK', :podspec => false

  # Set up framework and header search paths so IVA can locate SNAPSDK
  s.xcconfig = {
    'FRAMEWORK_SEARCH_PATHS' => '$(inherited) $(PODS_ROOT)/MyPod/Frameworks',
    'HEADER_SEARCH_PATHS' => '$(inherited) $(PODS_ROOT)/MyPod/Frameworks/SNAPSDK.framework/Headers'
  }
end
  • Make sure the paths in vendored_frameworks and xcconfig match where you’ve stored the frameworks in your Pod repo.
  • The :podspec => false flag tells CocoaPods this is a local framework, not a remote Pod dependency.

Step 2: Double-Check IVA’s Import Statement & Case Sensitivity

It’s easy to overlook, but macOS/iOS is case-sensitive when it comes to framework imports. If your framework is named SNAPSDK.framework, your import should be:

#import <SNAPSDK/SNAPSDK.h>

Using lowercase snapSDK in the import will cause a "file not found" error even if your paths are correct.

Step 3: Clear Caches & Reinstall Pods

Old cached configurations often cause weird, hard-to-debug issues. Run these commands to start fresh:

# Deintegrate pods from your test project
pod deintegrate
# Clean CocoaPods cache
pod clean
# Remove the lock file to ensure fresh dependency resolution
rm -rf Podfile.lock
# Reinstall pods with the updated spec
pod install

Also, clean your Xcode build folder with Cmd + Shift + K and restart Xcode to clear any leftover build artifacts.

Step 4: Verify Embedding Settings in Your Host Project

After reinstalling pods, check your host project’s Build Phases > Embed Frameworks:

  • Both SNAPSDK.framework and IVA.framework should be listed here.
  • Ensure the Code Sign On Copy option is set correctly (for development, you can use your team’s automatic signing, or disable it if the frameworks are already signed).

Once you’ve completed these steps, your MyPod should compile without the import error. The core fix is making sure CocoaPods understands the dependency between the two vendored frameworks and propagates the correct search paths to the build system.

内容的提问来源于stack exchange,提问作者Yoon Kang

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 06:30:35