将Cocoapods与App Extension一起使用 [英] Use Cocoapods with an App Extension

查看:441
本文介绍了将Cocoapods与App Extension一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用cocoapods库在Xcode 6 Beta-6中构建照片App扩展。
Xcode为照片扩展程序创建的桥接标题无法从cocoapods中看到任何内容。

I'm trying to build a photo App Extension in Xcode 6 Beta-6 that uses cocoapods libraries. The bridging header that Xcode creates for the photo extension can't see anything from cocoapods.

例如: #import< GPUImage / GPUImage.h> 导致错误找不到GPUI / GPUImage.h文件

我已经尝试了所有可以想象的导入路径(括号和引号)并且几乎没有成功。例外情况是,对于像 SVProgressHUD 这样的简单pod,以下丑陋可怕的黑客行为:
#import../Pods/SVProgressHUD/ SVProgressHUD / SVProgressHUD.h

I've tried every conceivable path for the import (with brackets and quotes) and have had almost no success. The exception is that for simple pods like SVProgressHUD, the following ugly terrible hack works: #import "../Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.h".

但是对于GPUImage,它会进入 GPUImage.h 标题,并决定它突然看不到 GPUImageContext.h 尽管没有问题,当导入它的桥接标头为正常的swift代码不属于应用程序扩展。

But for GPUImage, it walks into the GPUImage.h header and decides it suddenly can't see GPUImageContext.h despite having no issue when this is imported with the bridging header for the normal swift code that is not part of the app extension.

有什么不同的应用程序扩展编译阻止桥接标题表现得非常好?

What is different about the compilation of app extensions that is preventing the bridging header from behaving sanely?

注意:
我已经阅读了本教程并且它不是立即适用的,以防万一有人认为他们已经找到答案。

Note: I've read every possible permutation of this tutorial and it is not immediately applicable, just in case anyone thinks they have found the answer there.

此外,这个SO qu这可能是相关的,但无论如何我都会问这个问题,以防我的问题特定于应用扩展程序。

Also, the problem described in this SO question may be related, but I asked this question anyway in case my issue is specific to app extensions.

推荐答案

执行此操作的正确方法是更新podfile以仅添加1行:

The proper way to do this is to update your podfile to add just 1 line :

link_with 'yourApp', 'yourAppExtension'

并且pod更新应解决此问题。

and a pod update should resolve the issue.

这篇关于将Cocoapods与App Extension一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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