iOS SDK get bundle version

425
2
05-08-2019 02:30 AM
ThomasArnold
New Contributor II

is there a method in ArcGIS Runtime SDK for iOS to get bundle version?

0 Kudos
2 Replies
Nicholas-Furness
Esri Regular Contributor

Not out of the box, but there is this Swift extension we published as part of the data-collection-ios Open Source app: 

https://github.com/Esri/data-collection-ios/blob/1b846d7c8f19d994a83fae259ec2cceeef19be2f/data-colle... 
extension Bundle {
    
    private static let agsBundle = AGSBundle()
    
    /// An end-user printable string representation of the ArcGIS Bundle version shipped with the app.
    ///
    /// For example, "2000"
    
    static var sdkBundleVersion: String {
        return (agsBundle?.object(forInfoDictionaryKey: "CFBundleVersion") as? String) ?? "?"
    }
    
    /// An end-user printable string representation of the ArcGIS Runtime SDK version shipped with the app.
    ///
    /// For example, "100.0.0"
    
    static var sdkVersion: String {
        return (agsBundle?.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String) ?? "?"
    }
    
    /// Builds an end-user printable string representation of the ArcGIS Bundle shipped with the app.
    ///
    /// For example, "ArcGIS Runtime SDK 100.0.0 (2000)"
    
    static var ArcGISSDKVersionString: String {
        return String(format: "ArcGIS Runtime SDK %@ (%@)", sdkVersion, sdkBundleVersion)
    }
}
0 Kudos
ThomasArnold
New Contributor II

perfect, thank you very much!

0 Kudos