首页 > 解决方案 > 在 Xcode 10 中使用 MapboxNavigation iOS

问题描述

是否有可能将MapboxNavigation(版本0.210.22)iOS 与 Xcode 10 一起使用。在其 Github 和 CocoaPods 网站上声明,它只能与 Xcode 9 一起使用,但 Github 上的一些问题提到(成功)使用 Xcode 10 MapboxNavigation.

但是,我尝试MapboxNavigation使用 Xcode 10 通过 CocoaPods 安装并得到一堆错误:

/Users/Paul_Obernolte/Library/Developer/Xcode/DerivedData/pq-app-v2-gynuaxsohvqddqegrvemywowchkr/Build/Products/Debug-iphonesimulator/MapboxDirections.swift/Swift Compatibility Header/MapboxDirections-Swift.h:171:9: error: 'MapboxDirections/MapboxDirections.h' file not found
#import <MapboxDirections/MapboxDirections.h>
        ^
<unknown>:0: error: could not build Objective-C module 'MapboxDirections'

是否有任何解决方法可以避免使用 Xcode 10 出现此错误?

编辑:这是我的 Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'

EXPO_CPP_HEADER_DIR = 'ExpoKit'

target 'pq-app-v2' do
  pod 'MapboxDirections.swift', '~> 0.23'
  pod 'MapboxMobileEvents',
    :git => 'https://github.com/mapbox/mapbox-events-ios.git',
    :commit => "79d29f1df5a9187481f5c9ac8fa13430d1f04139"
  pod 'MapboxNavigation', '~> 0.21.0'

  ... (more Pods)

end

MapboxMobileEvents由于这个问题,我需要单独下载: https ://github.com/mapbox/mapbox-events-ios/pull/85

标签: iosxcodecocoapodsmapboxxcode10

解决方案


target 'pq-app-v2' do

   use_frameworks!

   ... (more Pods)

end

如果“use_frameworks!”,请更改 pod 文件中的代码 被评论而不是像上面那样取消评论。


推荐阅读