iOS pod安装gcm和pnchartswift [英] iOS pod install gcm and pnchartswift

查看:220
本文介绍了iOS pod安装gcm和pnchartswift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中使用了PNChartSwift和GCM。
我需要使用use_frameworks!对于PodFile中的PNChartSwift,对于GCM我不能使用use_frameworks!在PodFile中



我将如何使用gcm?



记录错误pod install

 使用PNChartSwift(0.0.2)
使用STZPopupView(1.0.1)
[!]'Pods'目标具有传递性包含静态二进制文件的依赖关系:(/Users/Sina/Desktop/MyShatelIOS/MyShatel/Pods/GGLInstanceID/Libraries/libGGLInstanceIDLib.a,/ Users / Sina / Desk / MyShatelIOS / MyShatel / Pod / Google / Libraries / libGGLCloudMessaging.a,/ Users / Sina / Desktop / MyShatelIOS / MyShatel / Pods / Google / Libraries / libGGLCore.a,/ Users / Sina / Desktop / MyShatelIOS / MyShatel / Pods / GoogleCloudMessa


解决方案

不幸的是,混合静态和动态库是不可能的,它是全有或全无的。

相反,我会建议您使用原始的Obj-C版本 PNChart ,它可以解决你使用GCM的问题。



这意味着你的pod文件wo

  podPNChart
podGoogle / CloudMessaging

/ code>

导入 PNChart 时唯一不同的做法是添加导入这些库的Briding头文件。这将使它们在代码中的任何地方都可用。它看起来如下所示:

  #import< PNChart.h> 
#import< Google / CloudMessaging.h>






更新1:



回答OP关于如何识别静态/动态的问题。






<作为一个经验法则:


  • 用Swift编写的所有依赖项都是动态框架。

  • 用Obj-C编写的所有依赖项都是静态库。



Apple不允许您构建包含Swift的静态库,因此第一条语句将始终为真。第二种说法有点复杂,因为Apple之前在Obj-C中构建了很多动态内部框架。这种可能性在iOS 8之前还没有提供给第三方开发人员(与Swift同时发布),所以不要指望用Obj-C编写的任何新框架都是动态的,因为它们也可以用Swift编写。 / p>

现在,我们只是在两种语言之间切换时处于不灵活阶段。在1 - 2年后,希望所有第三方依赖项的大部分都将用Swift编写,我们不必担心静态/ dyanmic等问题。

如果您有兴趣,那么您可以在 0.36版官方CocoaPods博客文章


I use PNChartSwift and GCM in my Project . I need use "use_frameworks!" for PNChartSwift in PodFile so for GCM i must not use "use_frameworks!" in PodFile

How will i use gcm ?

Log error "pod install"

Using PNChartSwift (0.0.2)
Using STZPopupView (1.0.1)
[!] The 'Pods' target has transitive dependencies that include static binaries: (/Users/Sina/Desktop/MyShatelIOS/MyShatel/Pods/GGLInstanceID/Libraries/libGGLInstanceIDLib.a, /Users/Sina/Desktop/MyShatelIOS/MyShatel/Pods/Google/Libraries/libGGLCloudMessaging.a, /Users/Sina/Desktop/MyShatelIOS/MyShatel/Pods/Google/Libraries/libGGLCore.a, /Users/Sina/Desktop/MyShatelIOS/MyShatel/Pods/GoogleCloudMessa

解决方案

Unfortunately it is not possible to mix static and dynamic libraries, it's all-or-nothing.

Instead I will suggest you to make use of of the original Obj-C version PNChart, which would solve your issue using GCM.

That means your podfile would look similar to the following:

pod "PNChart"
pod "Google/CloudMessaging"

The only thing you have to do differently when importing the PNChart is to add a briding header importing these libraries. This will make them available anywhere in the code. It would look something like the following:

#import <PNChart.h>
#import <Google/CloudMessaging.h>


UPDATE 1:

Answered OP's question about how to identify static/dynamic.


As a rule of thumb:

  • All dependencies written in Swift are dynamic frameworks.
  • All dependencies written in Obj-C are static libraries.

Apple doesn't let you build static libraries that contain Swift, so the first statement will always be true. The second statement is a bit more complicated, since Apple has previously built a lot of dynamic internal frameworks in Obj-C. This possibility has not been available to third-party developers until iOS 8 (same time as Swift was released), so don't expect any new frameworks written in Obj-C to be dynamic since they might as well be written in Swift.

Right now we are simply in a stage of "limbo" when switching between the two languages. In 1-2 years then hopefully the majority of all third-party dependencies will be written in Swift and we don't have to worry about things like static/dyanmic.

If you are interested, then you can read more about it on the official CocoaPods blog post for release 0.36.

这篇关于iOS pod安装gcm和pnchartswift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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