FlavorScape
FlavorScape

Reputation: 14309

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".

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

Upvotes: 6

Views: 1677

Answers (1)

Kamil.S
Kamil.S

Reputation: 5543

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.

Upvotes: 3

Related Questions