4

我想GoogleMaps在我的 Cocoapod 库中使用。

cocoapod 中有GoogleMaps。但是,你不能使用dependency,因为它是静态库。大概...

我参考了这个答案。
使用 Swift 构建 Cocoapod 并依赖于 Objective-C 框架
,并且构建库成功。

在示例项目中使用构建的库时出现问题。

当我构建示例项目时,第一个问题是

ld:未找到架构 arm64 的 GoogleMaps 框架

而且,我尝试添加GoogleMaps到示例项目的Podfile.
下一个问题是

“Pods-MapLibraryWrapper_Example”目标具有名称冲突的框架:GoogleMaps。

有没有办法解决这个问题?或者,还有其他使用方法GoogleMaps吗?

谢谢。

我的图书馆的 podspec 的一部分。

  s.platform     = :ios, '8.0'
  s.requires_arc = true

  s.source_files = 'Pod/Classes/**/*'
  s.resource_bundles = {
    'MapLibraryWrapper' => ['Pod/Assets/*.png']
  }
  s.ios.resource_bundle = { 'MapLibraryWrapper-ios' => 'Resources/*.png' }

  s.public_header_files = 'Pod/Classes/**/*.h'
  s.frameworks = "Accelerate", "AVFoundation", "CoreData", "CoreLocation", "CoreText", "Foundation", "GLKit", "ImageIO", "OpenGLES", "QuartzCore", "SystemConfigurati\
on", "GoogleMaps"
  # s.dependency 'GoogleMaps'
  s.libraries = "c++", "icucore", "z"
  s.vendored_frameworks = 'Dependencies/GoogleMaps.framework'

  s.prepare_command = './download-googlemaps.sh'

目录结构

$(project_root)
    |- MapLibraryWrapper.podspec
    |- Dependencies/
        |- GoogleMaps.framework
    |- Example
        |- Podfile

示例/Podfile

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target 'MapLibraryWrapper_Example', :exclusive => true do
  pod 'MapLibraryWrapper', :path => '../'
  pod 'GoogleMaps'
end

target 'MapLibraryWrapper_Tests', :exclusive => true do
  pod 'MapLibraryWrapper', :path => '../'

  pod 'Quick', '~> 0.8.0'
  pod 'Nimble', '3.0.0'
end
4

0 回答 0