App is reading version from main bundle instead of the bundle specified

35 views Asked by At

Consider the following code

func fillVersionFor(for aClass: AnyClass, key: String) {
    let shortVersionStringKey = "CFBundleShortVersionString"
    let bundle = Bundle(for: aClass)
    if let build = bundle.infoDictionary?[shortVersionStringKey] as? String {
        ForDevelopersViewModel.sdkVersions[key] = build
    }
}

func extractSDKVersions() {
    fillVersionFor(for: ClassForSDK1.self, key: "SDK1")
    fillVersionFor(for: ClassForAdifferentSDK.self, key: "AdifferentSDK")
}

It works correctly in debug builds but in builds for testflight it pulls the version of the application (from the main bundle that is).

Any insights what could have possibly went wrong?

0

There are 0 answers