Comments (11)
Hi @amzada, it seems that you are using mapbox-navigation-ios
v2 that still depends on mapbox-direction-swift
that is not compatible with mapbox-maps-ios
v11. Could you try update your dependencies to use mapbox-navigation-ios
v3.0.2 or latest?
from mapbox-maps-ios.
hello @maios thank you for your answer. I was indeed using latest version of mapbox-navigation-ios
but realised from your comment that I no longer need mapbox-direction-swift
.
The error I am now getting is:
multiple targets named **MapboxCoreMaps** in: **mapbox-core-maps-ios,** **mapbox-navigation-ios**; consider using the moduleAliases parameter in manifest to provide unique names
How can I resolve this?
from mapbox-maps-ios.
Could you provide your package manifest? IIUC mapbox-navigation-ios already have dependencies on mapbox-maps-ios
from mapbox-maps-ios.
@maios yep that's right. I can provide the package manifests that come with the libraries if that's what you mean?
MapboxNavigation
// swift-tools-version: 5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let version = "3.0.2"
let binaries = [
"MapboxCoreMaps": "a164dc57d0c3eaffe9a6fd493f5d2bef47cbf3fd9a0365679771e78df0421f37",
"MapboxDirections": "a2e19aa52a0aa78417f379fb60aef1772ae00da777e92c761febc6a6ea744554",
"MapboxMaps": "ffd302cd2d6fbadd37bff6d391a2c48fcb7aa2620a219103ce7a2a5e3c7b9fb0",
"Turf": "4eabc83d358f6962a80bec3a988723c5e7eda20d85333d019966c4ec12b5c066",
"MapboxNavigationCore": "ecfab910af2df3b430c3094501b904c54e12fb773a63f2eabaa8885fb75dec43",
"_MapboxNavigationUXPrivate": "9c3a30a473e28361c34d6dd8ab8c8c5f501094b2a1699a31fe898448cdebba25",
"MapboxNavigationUIKit": "203e840e647bb10799a6348ade7730cc2a5d59f058fc74ef8b69437e737a86a3",
]
let package = Package(
name: "MapboxNavigation",
platforms: [.iOS(.v14)],
products: [
.library(
name: "MapboxNavigationCore",
targets: ["MapboxNavigationCoreWrapper"]
),
.library(
name: "MapboxNavigationUIKit",
targets: ["MapboxNavigationUIKitWrapper"]
),
],
dependencies: [
.package(url: "https://github.com/mapbox/mapbox-common-ios.git", exact: "24.3.1"),
.package(url: "https://github.com/mapbox/mapbox-navigation-native-ios.git", exact: "305.0.0"),
],
targets: [
.target(
name: "MapboxNavigationCoreWrapper",
dependencies: binaries.keys.map { .byName(name: $0) } + [
.product(name: "MapboxCommon", package: "mapbox-common-ios"),
.product(name: "MapboxNavigationNative", package: "mapbox-navigation-native-ios"),
]
),
.target(
name: "MapboxNavigationUIKitWrapper",
dependencies: [
"MapboxNavigationCoreWrapper"
]
),
] + binaryTargets()
)
func binaryTargets() -> [Target] {
return binaries.map { binaryName, checksum in
Target.binaryTarget(
name: binaryName,
url: "https://api.mapbox.com/downloads/v2/navsdk-v3-ios" +
"/releases/ios/packages/\(version)/\(binaryName).xcframework.zip",
checksum: checksum
)
}
}
Mapbox Maps
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
import Foundation
let coreMaps = MapsDependency.coreMaps(version: "11.3.0")
let common = MapsDependency.common(version: "24.3.1")
let mapboxMapsPath: String? = nil
let package = Package(
name: "MapboxMaps",
defaultLocalization: "en",
// Maps SDK doesn't support macOS but declared the minimum macOS requirement with downstream deps to enable `swift run` cli tools
platforms: [.iOS(.v12), .macOS(.v10_15), .custom("visionos", versionString: "1.0")],
products: [
.library(
name: "MapboxMaps",
targets: ["MapboxMaps"]),
],
dependencies: [
.package(url: "https://github.com/mapbox/turf-swift.git", exact: "2.8.0"),
] + coreMaps.packageDependencies + common.packageDependencies,
targets: [
.target(
name: "MapboxMaps",
dependencies: [
coreMaps.mapsTargetDependencies,
common.mapsTargetDependencies,
.product(name: "Turf", package: "turf-swift")
],
path: mapboxMapsPath,
exclude: [
"Info.plist",
],
resources: [
.copy("MapboxMaps.json"),
.copy("PrivacyInfo.xcprivacy"),
]
),
.testTarget(
name: "MapboxMapsTests",
dependencies: [
"MapboxMaps",
],
resources: [
.copy("MigrationGuide/Fixtures/polygon.geojson"),
.copy("Helpers/MapboxAccessToken"),
.copy("Resources/empty-style-chicago.json"),
.copy("Snapshot/testDoesNotShowAttribution().png"),
.copy("Snapshot/testDoesNotShowLogo().png"),
.copy("Snapshot/testDoesNotShowLogoAndAttribution().png"),
.copy("Snapshot/testShowsLogoAndAttribution().png"),
.copy("Snapshot/testSnapshotAttribution-100.png"),
.copy("Snapshot/testSnapshotAttribution-150.png"),
.copy("Snapshot/testSnapshotAttribution-200.png"),
.copy("Snapshot/testSnapshotAttribution-250.png"),
.copy("Snapshot/testSnapshotAttribution-300.png"),
.copy("Snapshot/testSnapshotAttribution-50.png"),
.copy("Snapshot/testSnapshotLogoVisibility.png"),
.copy("Snapshot/testSnapshotOverlay.png"),
.process("Resources/MapInitOptionsTests.xib"),
]
)
] + coreMaps.packageTargets + common.packageTargets
)
struct MapsDependency {
init(name: String, version: String, checksum: String? = nil, isSnapshot: Bool?, repositoryName: String, registryProjectName: String, registryFileName: String) {
self.name = name
self.version = version
self.checksum = checksum
self.isSnapshot = isSnapshot ?? version.contains("SNAPSHOT")
self.repositoryName = repositoryName
self.registryProjectName = registryProjectName
self.registryFileName = registryFileName
}
let name: String
let version: String
let checksum: String?
let isSnapshot: Bool
let repositoryName: String
let registryProjectName: String
let registryFileName: String
static func coreMaps(version: String, checksum: String? = nil, isSnapshot: Bool? = nil) -> MapsDependency {
return MapsDependency(name: "MapboxCoreMaps", version: version, checksum: checksum, isSnapshot: isSnapshot,
repositoryName: "mapbox-core-maps-ios",
registryProjectName: "mobile-maps-core",
registryFileName: "MapboxCoreMaps.xcframework-dynamic.zip")
}
static func common(version: String, checksum: String? = nil, isSnapshot: Bool? = nil) -> MapsDependency {
return MapsDependency(name: "MapboxCommon", version: version, checksum: checksum, isSnapshot: isSnapshot,
repositoryName: "mapbox-common-ios",
registryProjectName: "mapbox-common",
registryFileName: "MapboxCommon.zip")
}
var packageDependencies: [Package.Dependency] {
guard !isSnapshot else { return [] }
return [
.package(url: repositoryURL, exact: Version(stringLiteral: version))
]
}
var packageTargets: [Target] {
guard isSnapshot else { return [] }
return [
.binaryTarget(name: name, url: registryURL, checksum: checksum ?? "")
]
}
var mapsTargetDependencies: Target.Dependency {
if isSnapshot {
return .byName(name: name)
} else {
return .product(name: name, package: repositoryName)
}
}
var repositoryURL: String { return "https://github.com/mapbox/\(repositoryName).git" }
var registryReleaseFolder: String { isSnapshot ? "snapshots" : "releases" }
var registryURL: String {
return "https://api.mapbox.com/downloads/v2/\(registryProjectName)/\(registryReleaseFolder)/ios/packages/\(version)/\(registryFileName)"
}
}
from mapbox-maps-ios.
hi @maios any update on this?
from mapbox-maps-ios.
NavSDK already bundles MapboxMaps SDK, their v3 should be compatible with our v11, so I think you can remove your dependency on MapboxMaps SDK and use only NavSDK.
from mapbox-maps-ios.
are you certain that I'm able to do this @maios ? I believe I tried this but couldn't get MapboxMaps SDK from NavSDK
from mapbox-maps-ios.
Yes I am certain. What is the error you get when you tried to access MapboxMaps from NavSDK?
from mapbox-maps-ios.
ahh thanks for the image @maios - I think I was trying it in a different way ie by looking for separate frameworks and not directly importing MapboxMaps. Will try this!
from mapbox-maps-ios.
@amzada did you resolve this issue?
from mapbox-maps-ios.
@maios Hi, I encountered the same problem. Can you please share your Package.swift
file from the TestSPM
package? Especially the target dependencies part.
I tried to reproduce this, but without success. Mine look like following (target dependencies part commented with Error message provided)
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "TestSPM",
products: [
.library(
name: "TestSPM",
targets: ["TestSPM"]
)
],
dependencies: [
.package(url: "https://github.com/mapbox/mapbox-navigation-ios.git", .upToNextMajor(from: "3.1.0"))
],
targets: [
.target(
name: "TestSPM",
dependencies: [
// ERROR: product 'MapboxMaps' required by package 'testspm' target 'TestSPM' not found in package 'mapbox-navigation-ios'. Did you mean 'MapboxMaps'?
// .product(name: "MapboxMaps", package: "mapbox-navigation-ios"),
// ERROR: product 'MapboxNavigation' required by package 'testspm' target 'TestSPM' not found in package 'mapbox-navigation-ios'. Did you mean 'MapboxNavigationCore'?
// .product(name: "MapboxNavigation", package: "mapbox-navigation-ios"),
]),
.testTarget(
name: "TestSPMTests",
dependencies: [
"TestSPM"
]
),
]
)
With above package the compiler is indeed suggesting to import MapboxMaps, but then, after build it fails with No such module 'MapboxMaps'
error
from mapbox-maps-ios.
Related Issues (20)
- Interprocess communication with main thread when returning `compatibleAuthorizationStatus` HOT 1
- [Error, maps-core]: {}[Style]: Failed to load tile 5/5/12=>5 for source composite: HTTP status code 401 HOT 1
- Need Help in coverting a mapbox function HOT 1
- Adding a polyline with a set .linePattern property breaks other polyline annotations inside of the same annotation manager
- .netrc file in Github Actions? HOT 4
- Swift 6 support HOT 3
- Crash when using CustomRasterSourceTileRenderer
- Crashed: com.mapbox.common.TileStoreFileSource HOT 3
- PointAnnotation not displaying in SwiftUI HOT 2
- Viewport VisibleBounds is missing HOT 4
- Warnings received from App Store when uploading new builds through Xcode 16 beta 6 Organiser HOT 2
- Mapbox forcing location updates while app is in background HOT 1
- I Want to show image for polygon feature HOT 1
- ITMS-91056: Invalid privacy manifest - The PrivacyInfo.xcprivacy file from the following path is invalid: “Frameworks/MapboxCommon.framework/PrivacyInfo.xcprivacy”. Keys and values in your app’s privacy manifests must be valid. HOT 1
- Asset validation failed - Code=90482 - MapboxMobileEvents.framework/MapboxMobileEvents contains bitcode HOT 13
- Can't download Mapbox-Map Version 11.6.1 HOT 2
- Question on SwiftUI HOT 1
- Crash with EXC_BAD_ACCESS in com.mapbox.common.location.sharedRunloop, onAccuracyAuthorizationChanged HOT 1
- Debounce raster layer updates
- visionOS panning and zooming gestures broken when rotating the map in a 3D volume HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-maps-ios.