pod 管理本地 alipay第三方库遇到的问题总结

2019-02-28  本文已影响7人  充满活力的早晨

今天想把alipay 迁移到pod本地库中管理,可是并不顺利,特此记录下问题

The 'XXX' target has libraries with conflicting names: libcrypto.a and libssl.a.

原因

这个问题是因为我们用pod管理的第三库百度地图中也有libcrypto.a 和 libssl.a 两个库。而pod本身加载本地库也添加了libcrypto.a 和 libssl.a ,因此工程中有了两个libcrypto.a 和 libssl.a 库。

解决方式

首先找到pod 管理中引用这两个库的第三方库,将这两个库删除掉。

例如,百度地图


百度地图删除libcrypto.a 和 libssl.a 的样子

然后执行 下列命令 pod install --verbose --no-repo-update 就可以了

这里说名下,执行这个命令必须让本地的libcrypto.a 和 libssl.a 库在pod中被引用,否则,又会将libcrypto.a 和 libssl.a 这两个库加入到相应的第三方库中。

#include <openssl/asn1.h> not in found

原因

这个问题是openssl的头文件引用问题

解决方式

在自己制作的本地podspec文件中加入下列代码

s.header_mappings_dir = "Classes/**"

pod管理本地第三方库alipay的最终podspec文件

Pod::Spec.new do |s|

  # ―――  Spec Metadata  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  These will help people to find your library, and whilst it
  #  can feel like a chore to fill in it's definitely to your advantage. The
  #  summary should be tweet-length, and the description more in depth.
  #

  s.name         = "AlipaySDK"
   s.version      = "0.0.1"
  s.summary      = "支付宝支付"

  s.description  = "支付宝支付费用"

  s.homepage     = "https://www.baidu.com"

  s.license      = { :type => "MIT", :file => "LICENSE" }
  s.author             = { "yourName" => "email@qq.com" }
  s.platform     = :ios, "8.0"
  s.ios.deployment_target = "8.0"
  s.requires_arc = true
  s.source       = { :git => "", :tag => "#{s.version}" }
  s.source_files  = "Classes", "Classes/**/*.{h,m}"
  s.public_header_files = "Classes/**/*.h"
  #头文件路径
  s.header_mappings_dir = "Classes/**"

  s.resources = "AlipaySDK.bundle"
  s.vendored_libraries="*.{a}"
  s.vendored_frameworks="AlipaySDK.framework"

end

第三方库制作命令

pod spec create XXX

上一篇 下一篇

猜你喜欢

热点阅读