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

iOS项目集成JonkyKong's SideMenu遇“No Such Module”错误求助

Fixing "No Such Module 'SideMenu'" in Swift 4.0 iOS Project

Hey there, I’ve run into this exact frustration before with CocoaPods/Carthage and Swift version mismatches—let’s work through this step by step to get SideMenu up and running for your project.

First, Double-Check the Basics

  • Always open the .xcworkspace file (not .xcodeproj) when using CocoaPods. It’s the most common oversight that causes this error.
  • Confirm your project’s Deployment Target matches SideMenu’s requirements (for Swift 4.0, SideMenu v5.x requires iOS 9.0+). If your target is lower, that could break the framework import.

Fix for CocoaPods Installations

1. Update Your Podfile for Swift 4.0 Compatibility

Older versions of CocoaPods don’t always auto-set the correct Swift version for dependencies. Add a post-install hook to force SideMenu to use Swift 4.0:

platform :ios, '9.0'
use_frameworks!

target 'YourProjectName' do
  pod 'SideMenu'
end

# Force all pods to use Swift 4.0
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.0'
    end
  end
end

2. Perform a Full Clean & Reinstall

Close Xcode completely, then run these commands in your project directory:

pod deintegrate
pod clean
rm -rf ~/Library/Developer/Xcode/DerivedData  # Wipes all cached builds
pod install

Open the .xcworkspace file again and try importing SideMenu.

3. Verify Framework Search Paths

In your project’s Build Settings, search for Framework Search Paths and make sure it includes:

  • $(inherited) (set to recursive)
  • ${PODS_ROOT}/SideMenu (also recursive)

Fix for Carthage Installations

1. Confirm Cartfile Points to a Swift 4.0-Compatible Version

SideMenu v5.x is the first version to support Swift 4.0. Update your Cartfile:

github "JonkyKong/SideMenu" ~> 5.0

2. Reinstall & Verify Framework Setup

Run this to pull the correct version:

carthage update --platform iOS

Then:

  • Go to your project’s General tab, under Linked Frameworks and Libraries, make sure SideMenu.framework is added (and it’s pulled from Carthage/Build/iOS/).
  • Check your Build Phases: Add a Run Script phase with this command:
    /usr/local/bin/carthage copy-frameworks
    
    Then add $(SRCROOT)/Carthage/Build/iOS/SideMenu.framework to the Input Files section.

3. Full Clean & Restart

Same as with CocoaPods: Delete DerivedData, restart Xcode, and rebuild your project.


Last-Ditch Troubleshooting

  • Create a brand new Swift 4.0 test project and install SideMenu using the same method. If it works there, the issue is with your main project’s configuration (check for conflicting build settings or multiple targets with mismatched setups).
  • Double-check SideMenu’s release notes to confirm the version you’re installing explicitly supports Swift 4.0 (avoid versions older than 5.0).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 08:43:07