当工作空间中有多个xcode项目时,如何将cocoapods cordova插件src链接到.framework头文件? [英] How to link a cocoapods cordova plugin src to a .framework header file when there's multiple xcode projects in the workspace?

查看:114
本文介绍了当工作空间中有多个xcode项目时,如何将cocoapods cordova插件src链接到.framework头文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

独特的情况是,这是一个Ionic应用程序,可通过Pod提取未编译的插件源.问题在于,编译时,插件头和实现无法找到.framework的头/实现.演示版Cordova应用程序找到了.framework,但它们只是在一个项目中.

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

  • 将.framework添加到pod项目或app项目的链接库中
  • 为每个目标,每个应用(及其组合)添加搜索路径
  • 添加链接的二进制文件
  • 添加标题/源以构建阶段
  • s.vendored_frameworks = 'ValidicMobile.framework添加到podspec并执行pod update
  • 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

接下来要尝试的是什么?假设pod可以更好地进行链接,将供应商.framework封装在cocoapod中是否可以帮助插件找到框架?该插件需要在Pod中导入其他Cordova框架,因此不确定我是否可以将src直接放在主应用程序中.

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.

推荐答案

我不确定它是否适用于您的方案,但是回想一下,我确实为podfile中的其中一个Pod发布了PCH文件的处理.

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

这使我能够在pod install期间将所有Pod的所有源都检出之后,在pod级别上注入额外的标题导入.

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.

这篇关于当工作空间中有多个xcode项目时,如何将cocoapods cordova插件src链接到.framework头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆