简体   繁体   English

当工作区中有多个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?

The unique situation is that this is an Ionic app that pulls in the uncompiled plugin source via pods. 独特的情况是,这是一个Ionic应用程序,通过pod提取未编译的插件源。 The problem is that when compiling, the plugin headers and implementation can't find the .framework's headers/implementation. 问题是,在编译时,插件头和实现无法找到.framework的头文件/实现。 The demo Cordova app finds the .framework, but they're only in a single project. 演示Cordova应用程序找到.framework,但它们只在一个项目中。

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 将.framework添加到pods项目或app项目的链接库中
  • 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 s.vendored_frameworks = 'ValidicMobile.framework添加到podspec并执行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? 将供应商.framework包装在cocoapod中可以帮助插件找到框架,假设pod更适合链接吗? 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. 该插件需要在pod中导入其他Cordova框架,因此不确定我是否可以将src直接放在主应用程序中。

项目结构

在此输入图像描述

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 . 我不确定它是否适用于您的场景,但回过头来我在podfile为我的一个pod发布了PCH文件的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. 这允许我在已经检出pod install所有源之后,在pod install期间在pod级别上注入额外的头部导入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在同一工作区中的iOS Framework和App Project中使用Cocoapods - Using Cocoapods in iOS Framework and App Projects in the same workspace 如何将Crittercism集成到具有多个子项目的Xcode工作区中? - How to integrate Crittercism into an Xcode workspace with multiple sub-projects? Xcode Cocoapods找不到框架头文件 - Xcode Cocoapods Not Finding Framework Header Files 具有多个项目和Coca Pod设置的Xcode工作区 - Xcode Workspace with Multiple Projects and Coca Pods Setup 如何将 CocoaPods 依赖项与 Cordova 插件捆绑在一起? - How to bundle CocoaPods dependencies with Cordova Plugin? 如何为Cordova插件使用本地CocoaPods依赖项? - How to use local CocoaPods dependencies for Cordova Plugin? 在构建基于CocoaPods的Xcode工作区时,Jenkins中的权限错误 - Permissions error in Jenkins when building CocoaPods based Xcode workspace 使用Xcode 6时,AFNetworking与cocoapods链接错误 - AFNetworking with cocoapods link error when using Xcode 6 使用CocoaPods将Objective-C框架与同一工作空间中的多个目标链接 - Linking an Objective-C framework with multiple targets in the same workspace with CocoaPods 如何创建包含2个iOS项目和iOS动态框架项目的Xcode 6工作区? - How to create a Xcode 6 workspace that includes 2 iOS Projects and an iOS Dynamic Framework project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM