iOS pod install gcm and pnchartswift

99封情书 提交于 2019-12-06 16:08:47

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/31227189/ios-pod-install-gcm-and-pnchartswift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!