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

React Native项目iOS构建报错Module 'SquareReaderSDK' not found求解决

Fixing "Module 'SquareReaderSDK' not found" in iOS Build with react-native-square-reader-sdk 1.3.0

I’ve run into this exact issue before with React Native 0.60.x and the Square Reader SDK. Let’s walk through the most common fixes step by step:

1. Verify CocoaPods Configuration & Reinstall Pods

React Native 0.60+ uses autolinking, but Square’s SDK relies on a specific CocoaPods source that might not be set up correctly:

  • Open your ios/Podfile and make sure these two sources are at the top of the file (before any target definitions):
    source 'https://github.com/CocoaPods/Specs.git'
    source 'https://github.com/square/cocoapods-specs.git'
    
  • Navigate to your ios directory in terminal and run:
    rm -rf Pods Podfile.lock
    pod install --repo-update
    
    The --repo-update flag ensures you pull the latest Square SDK specs.

2. Check Autolinking Status

Autolinking might have failed silently for the Square SDK:

  • Run the manual link command (even though RN 0.60+ uses autolinking, this can help resolve missing links):
    react-native link react-native-square-reader-sdk
    
  • Re-run pod install in the ios directory after linking.

3. Clear Xcode & Project Caches

Stale caches are a frequent culprit for module not found errors:

  • In Xcode, clean the build folder with Cmd + Shift + K, then delete derived data with Cmd + Option + Shift + K.
  • Delete your project’s node_modules folder, then reinstall dependencies:
    rm -rf node_modules
    npm install
    
  • Repeat the pod reinstall step from section 1 after this.

4. Validate Framework Search Paths in Xcode

Sometimes the SDK framework path isn’t properly added to your project:

  • Open your iOS project in Xcode, select your app target, go to Build Settings.
  • Search for Framework Search Paths and ensure it includes:
    • $(inherited) (set to recursive)
    • ../node_modules/react-native-square-reader-sdk/ios (set to recursive)
  • If these paths are missing, add them and rebuild the project.

5. Confirm Version Compatibility

Double-check that your versions play nice together:

  • react-native-square-reader-sdk 1.3.0 is compatible with React Native 0.60.x, but make sure you’re using a supported Xcode version (Square recommends Xcode 10.0+ for this SDK version).
  • Verify that you’ve completed all initial setup steps for the SDK (like adding the Square app ID to your Info.plist, though this usually causes runtime errors rather than build-time module not found issues).

If you work through these steps in order, the module not found error should resolve itself. Most often, the fix comes down to ensuring the Square CocoaPods source is added and doing a clean reinstall of pods and dependencies.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 08:30:21