iOS Question How I get the version of my app into a variable

Solution
B4X:
public Sub AppVersion As String
    
    Try
        Dim no As NativeObject
        no = no.Initialize("NSBundle").RunMethod("mainBundle", Null)
        Dim version As Object = no.RunMethod("objectForInfoDictionaryKey:", Array("CFBundleShortVersionString"))
        Return version
    Catch
        Log("AppVersion " & LastException.Message)       
        Return 0
    End Try
    
    
End Sub

Alex_197

Well-Known Member
Licensed User
Longtime User
B4X:
public Sub AppVersion As String
    
    Try
        Dim no As NativeObject
        no = no.Initialize("NSBundle").RunMethod("mainBundle", Null)
        Dim version As Object = no.RunMethod("objectForInfoDictionaryKey:", Array("CFBundleShortVersionString"))
        Return version
    Catch
        Log("AppVersion " & LastException.Message)       
        Return 0
    End Try
    
    
End Sub
 
Upvote 1
Solution
Top