iOS Question How to get ApplicationLabel and Version at runtime?

davemorris

Active Member
Licensed User
Hi all,
Maybe I'm being slow, but I can't seem to find any way to get the app's name and version at runtime?
I.e. the values of the Project Attributes #ApplicationLabel and #Version that are set in the Main module.

In B4A I would do it by calling Application.LabelName and Application.VersionName, but the B4i equivalent Application object doesn't appear to have the relevant properties?
 

Pendrush

Well-Known Member
Licensed User
B4X:
Sub AppName As String 
   Dim no As NativeObject
   no = no.Initialize("NSBundle").RunMethod("mainBundle", Null)
   Dim name As Object = no.RunMethod("objectForInfoDictionaryKey:", Array("CFBundleDisplayName"))
   Return name 
End Sub

Sub AppVersion As String
   Dim no As NativeObject
   no = no.Initialize("NSBundle").RunMethod("mainBundle", Null)
   Dim version As Object = no.RunMethod("objectForInfoDictionaryKey:", Array("CFBundleShortVersionString"))
   Return version 
End Sub
 
Top