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?
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
Hi,
is there any new version? This code will not work here...
B4X:
Error description: Current declaration does not match previous one.
Previous: {Type=Label,Rank=0, RemoteObject=True}
Current: {Type=Object,Rank=0, RemoteObject=True}
Error occurred on line: 34
Dim version As Object = no.RunMethod("objectForInfoDictionaryKey:", Array("CFBundleShortVersionString"))
Hi,
is there any new version? This code will not work here...
B4X:
Error description: Current declaration does not match previous one.
Previous: {Type=Label,Rank=0, RemoteObject=True}
Current: {Type=Object,Rank=0, RemoteObject=True}
Error occurred on line: 34
Dim version As Object = no.RunMethod("objectForInfoDictionaryKey:", Array("CFBundleShortVersionString"))
It doesnt have anything to do with the code.
The error message is suggesting there is a variable called version already there, and there is new variable with the type Object, also in code.
Change one and try again