使用 Cocoapods 0.37、Swift、框架找不到 GoogleAnalytics-iOS-SDK 的标头 [英] Can't find headers for GoogleAnalytics-iOS-SDK with Cocoapods 0.37, Swift, frameworks

查看:18
本文介绍了使用 Cocoapods 0.37、Swift、框架找不到 GoogleAnalytics-iOS-SDK 的标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Swift 项目中使用可可豆荚 0.37.0,使用 use_frameworks!在 podfile 中设置,我无法访问 GoogleAnalytics-iOS-SDK pod 的头文件.

Using cocoa pods 0.37.0 in a Swift project, with use_frameworks! set in the podfile, I am unable to access the header files for the GoogleAnalytics-iOS-SDK pod.

我应该如何在我的应用中访问 Google Analytics pod 的标头?

How should I access the Google Analytics pod's headers in my app?

我试过了;

import GoogleAnalytics_iOS_SDK

在 Swift 文件中,cocoapods 0.36 样式.但是没有再创建框架所以不好.

In a Swift file, cocoapods 0.36 style. But there's no framework created anymore so no good.

#import <GoogleAnalytics_iOS_SDK/GAI.h>

在桥接头中,但不起作用(没有模块映射?)

In the bridging header, but doesn't work (no module map ?)

我读过,在 cocoapods 0.37 (请参阅此提交).这似乎是为了应对 0.36 (请参阅此 SO 问题).

I have read that the behaviour for pods that only include headers in their 'sourse_files' changed in cocoapods 0.37 (see this commit). This appears to be in response to the problems that use_frameworks caused with these pods in 0.36 (see this SO question).

随着 Cocoapod 行为的这种变化,静态库被正确集成(它不是 0.36),符号被编译到应用程序中并在运行时可用.但我无权访问标题.

With this change in Cocoapod behaviour, the static library is integrated correctly (it wasn't with 0.36), the symbols are compiled into the app and available at runtime. But I don't have access to the headers.

推荐答案

这是 Cocoapods 0.37.0 中的一个错误.它已作为 issue #3499 登录到他们的跟踪器中.

This is a bug in Cocoapods 0.37.0. It has been logged in their tracker as issue #3499.

解决方法

  • $(SRCROOT)/Pods/GoogleAnalytics-iOS-SDK 添加到应用目标的 Build Settings 中的 User Header Search Paths(设置为 Recursive).
  • 使用 #import "GAI.h"
  • 在桥接标头中直接引用 Google Analytics 标头
  • Add $(SRCROOT)/Pods/GoogleAnalytics-iOS-SDK to the User Header Search Paths (set to Recursive) in the app target's Build Settings.
  • Reference the Google Analytics header directly in the Bridging Header with #import "GAI.h"

这篇关于使用 Cocoapods 0.37、Swift、框架找不到 GoogleAnalytics-iOS-SDK 的标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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