Sam
Sam

Reputation: 1249

Swift Compiler Error: Missing required modules;

I want to create custom pod which is depends on other pod. I have podspec file

 ...
 s.source_files = "ios/**/*.{h,c,m,swift}"
 s.requires_arc = true

 s.dependency "UserSDK" 

UserSDK is pod which i want to use in my custom module. It has own dependencies like FirebaseCore, FirebaseMessaging UserSDK podspec

In my CustomModule.swift file has

import Foundation
import UserSDK

To use custom library include it via pod file;

# Uncomment the next line to define a global platform for your project
# platform :ios, '11.0'

target 'MyTarget' do

pod 'FBLazyVector', :path => "../modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../modules/react-native/'
pod 'React-Core', :path => '../modules/react-native/'
pod 'React-CoreModules', :path => '../modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../modules/react-native/'
pod 'React-RCTActionSheet', :path => '../modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../modules/react-native/'

pod 'CustomModule', :path => "../CustomModule"

end

errorenter image description here

If I add use_frameworks! to target in podfile it works, but then other dependencies do not work

Upvotes: 5

Views: 5098

Answers (1)

Nayan Dave
Nayan Dave

Reputation: 1680

In the podspec file , couple fields are missing I guess like

  • Deployment_Target

  • Source Files

    Use inherit! :search_paths in Podfile before end.

Refer : https://ronakshah.org/How-To-Make-A-Cocoapod-With-Dependencies

and for your specific error add following in podfile

pod 'Firebase/Core'
pod 'Firebase/Messaging'

OR refer : Xcode error: Missing required module 'Firebase'

Swift app: “Missing required module” when importing framework that imports static library

Upvotes: 3

Related Questions