Closed ghost closed 2 years ago
Is the correct workaround for now to just import into the Xcode project as a framework or cocoa pod so it will pickup the values from Version.xcconfig?
Thanks for the report, and sorry for introducing this bug. We were attempting to reduce the number of places where the version number is copy-pasted, but in retrospect it should have been obvious that this wouldn't work with Swift Package Manager.
In the short run you can point your Swift Package Manager at the contributions
branch, which now includes your fix, and we'll get it in our next release as soon as we can.
I've merged this to main
and replaced the v6.0.2
tag to point to the new commit, so that folks pulling down this version/package for the first time should be able to avoid this issue.
If you're already seeing this issue you may need to click File > Packages > Reset Package Cache in Xcode.
Thanks for taking care of this so quickly! I wonder if you could solve the problem of having to cut/paste for every release with something like SE-0303 Package Manager Extensible Build Tools.
...or alternately update the code below in Environment.swift to read the version string directly out of Version.xcconfig instead of Version.plist
lazy var sdkVersion: Version = {
// First look for Version.plist, which is a workaround for Swift Package Manager.
if let url = Bundle.module.url(forResource: "Version", withExtension: "plist"),
let data = try? Data(contentsOf: url),
let infoDictionary = try? PropertyListSerialization.propertyList(from: data, options: [], format: nil) as? [String: Any],
let versionString = infoDictionary["CFBundleShortVersionString"] as? String
{
return Version(string: versionString)
}
Thanks, @provBarryTolnas. Will take a look at this with the engineering team. Always appreciate the feedback!
For the time being we're going to make sure manually updating the version when we do a release. I'm going to go ahead and close this since the immediate bug seems to resolved.
When installing ApptentiveKit 6.0.2 via Swift Package Manager, calls to
Apptentive.shared.register(with:completion:)
failed with a 422 client error. The response body to the POST to /conversations endpoint has the message "App release Sdk version is invalid". (see below) Cloning the repo, inserting the actual 6.0.2 version number into Version.plist resolves the issue. I put this fix up in PR#14 but this is probably not the proper fix since the value is expected to be pulled from Version.xcconfig.It appears that the Resources/Version.plist contains a
CFBundleShortVersionString
value of$(APPTENTIVE_VERSION)
instead of the actual version of the SDK and this value is loaded in Environment.swift in theEnvironment.sdkVersion
lazy var and eventually sent in the POST to the /conversations endpoint.Error Response:
This 422 was from a Post to the URL with a payload that seems to have a variable interpolation problem see the occurrences of
$(APPTENTIVE_VERSION)
in the header and two instances in request body forsdk_version
field andsdk_distribution_version
below (Note: some values elided with xxxxxx):