5

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

Nayan Dave
  • 1,078
  • 1
  • 8
  • 30
Sam
  • 1,079
  • 2
  • 7
  • 10
  • Show how you're embedding your custom pod into your app. Messing around with framework search path should not be necessary. Also, `requires_src` is probably a typo of `requires_arc` , and `dependency` is spelled with two `n`s. – Gereon May 18 '20 at 14:37
  • Did you tried to reinstall the UserSDK pod? It seems be missing ${PODS_ROOT}/Google/Headers... Try to add that to headers path – Carla Camargo May 18 '20 at 14:37
  • @Carla Camargo yes i tried, also cant find Google in pods, but there are FirebaseCore, FireabaseInstanceID and FirebaseMessaging, Adding it to headers path doesnt work – Sam May 18 '20 at 17:40
  • @Gereon updated my question., also removed path from framework searh path. It seems its not necessary like you said – Sam May 19 '20 at 12:43
  • Please show your full list of pods, or ideally, your complete Podfile – Gereon May 20 '20 at 14:28
  • @Gereon update my question. I searched a lot and it seems i need to add module map to my library to make available firebase. not sure [.https://stackoverflow.com/questions/31757417/swift-app-missing-required-module-when-importing-framework-that-imports-stati](.https://stackoverflow.com/questions/31757417/swift-app-missing-required-module-when-importing-framework-that-imports-stati) – Sam May 20 '20 at 20:50
  • What's not working with `use_frameworks!`? – Paul Beusterien May 21 '20 at 00:41
  • Did you create UserSDK that have FirebaseCore, Firebase frameworks inside ? – King.lbt May 25 '20 at 03:08

1 Answers1

3

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

Muhammad Asyraf
  • 1,748
  • 15
  • 20
Nayan Dave
  • 1,078
  • 1
  • 8
  • 30