Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link a cocoapods cordova plugin src to a .framework header file when there's multiple xcode projects in the workspace?

The unique situation is that this is an Ionic app that pulls in the uncompiled plugin source via pods. The problem is that when compiling, the plugin headers and implementation can't find the .framework's headers/implementation. The demo Cordova app finds the .framework, but they're only in a single project.

I've tried all the suggestions for "header file not found".

  • Adding the .framework to the linked libraries of either the pods project or the app project
  • Adding search paths to every target, every app (and combinations thereof)
  • Adding a linked binary
  • Adding headers/sources to build phases
  • add s.vendored_frameworks = 'ValidicMobile.framework to the podspec and doing pod update

What might be the next thing to try? Would wrapping the vendor .framework in a cocoapod help the plugin find the framework, assuming pods would be better at linking? The plugin requires the import of the other Cordova frameworks in the pods, so not sure if I can put the src directly in the main app or not.

project strucuture

enter image description here

like image 765
FlavorScape Avatar asked May 30 '19 19:05

FlavorScape


1 Answers

I'm not sure if it's applicable for your scenario, but way back I did post processing of the PCH file for one of my pods in the podfile.

    platform :ios, '7.0'
    pod 'A','7.4.1'
    pod 'B', '0.3.1-beta2'
    pod 'C', '0.6.5'

    post_install do | installer |
       print "Updating #{installer.sandbox.target_support_files_root}/Pods-A/A.pch\n"
       open("#{installer.sandbox.target_support_files_root}/Pods-A/A.pch","a") do |file|
       file.puts <<EOF
//your extra stuff goes here
#import "../../../A/Hacks/someExtraHeader1.h"
#import "../../../A/Hacks/someExtraHeader2.h"
EOF
       end
    end

That allowed me to inject extra header imports on pod level during pod install after all the sources of the pods have already been checked out.

like image 72
Kamil.S Avatar answered Nov 10 '22 21:11

Kamil.S