0

I am using Delphi 11 and need to get my app version number built in IOS. How to do it? In Android is easy but IOS I cannot find info.

Regards,

Thiago.

Dr. T
  • 19
  • 4

1 Answers1

1

This is one way:

uses
  Macapi.Helpers,
  iOSapi.Foundation;    

function GetAppVersion: string;
var
  LValueObject: Pointer;
begin
  Result := '';
  LValueObject := TNSBundle.Wrap(TNSBundle.OCClass.mainBundle).infoDictionary.objectForKey(StringToID('CFBundleVersion'));
  if LValueObject <> nil then
    Result := NSStrToStr(TNSString.Wrap(LValueObject));
end;

Note that in some cases you may wish to retrieve the value for CFBundleShortVersionString instead of CFBundleVersion.

Dave Nottage
  • 3,411
  • 1
  • 20
  • 57