There are 2 framework in my project. App imports Famework-A, and Framework-A imports Framework-B.
And Framework-B uses some oss like SQlite.
When I build these Frameworks, I haven't embed any framework, I embed them in my App.
And i was asked to use SPM only to build App but actually I need dynamic library because serveal parts in Framework-B use the same one like SQLite.
In order to build dynamic framewok using SPM, I fork the oss to my own github and add type:.dynamic
in Package.swift and then download them.
And then this error occurs. I also tried to embed these oss in Framewok-A and build the App, everything is ok.
here is the error:
dyld[2003]: Symbol not found: _$s6SQLite10ConnectionC8LocationO8inMemoryyA2EmFWC
Referenced from: <4B8F1B6D-C959-38BE-84E4-B93DF2BF0DDC> /private/var/containers/Bundle/Application/E6C1C0C2-AC80-4562-AA80-05373206ED9E/MPTDKSampleApp.app/Frameworks/DeviceAgentLogs.framework/DeviceAgentLogs
Expected in: <FC6697C5-DD8F-36D0-86B5-A0A7E817FB71> /private/var/containers/Bundle/Application/E6C1C0C2-AC80-4562-AA80-05373206ED9E/MPTDKSampleApp.app/Frameworks/SQLite.framework/SQLite
SQLite-Connection-Location-inMemory
is part of the source in SQLite and it should be located in ./Frameworks/SQLite.framework/SQLite
.
My question is MPTDKSampleApp.app/Frameworks/SQLite.framework/SQLite
is existed, so why this error happens?
here is the Package.swift i edited:
import PackageDescription
let package = Package(
name: "SQLite.swift",
platforms: [
.iOS(.v11),
.macOS(.v10_13),
.watchOS(.v4),
.tvOS(.v11)
],
products: [
.library(
name: "SQLite",
type:.dynamic,
targets: ["SQLite"]
)
],
targets: [
.target(
name: "SQLite",
exclude: [
"Info.plist"
]
),
.testTarget(
name: "SQLiteTests",
dependencies: [
"SQLite"
],
path: "Tests/SQLiteTests",
exclude: [
"Info.plist"
],
resources: [
.copy("Resources")
]
)
]
)
#if os(Linux)
package.dependencies = [
.package(url: "https://github.com/stephencelis/CSQLite.git", from: "0.0.3")
]
package.targets.first?.dependencies += [
.product(name: "CSQLite", package: "CSQLite")
]
#endif
Does anyone can help?