Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi and iOS File size

I created a small application in Delphi XE4 for iOS. I have 7 forms on it. And everything is good.

But I am a little bit shocked with file size! Its 44MB on Simulator. The same application I made for android was almost 2MB. It has a background image which is 320kb in jpg format I didn't test it on IPhone device yet!

What is the normal size application if you create on XCode with ListBox, texts, buttons on the forms?

Is there a way to decrease the filesize by changing any settings in Delphi?

like image 844
Barlet Avatar asked Jul 19 '13 17:07

Barlet


People also ask

How do I find the size of a file in Delphi?

In Delphi code, call FileSize to determine the size of the file specified by the file variable F. The size is expressed as the number of records in a record file. Thus: If the file is declared as a file of byte, then the record size defaults to one byte, and FileSize returns the number of bytes in the file.

How do I add additional Delphi forms to an iOS application?

Using the FireMonkey Mobile Form, you can add additional Delphi forms the same way you do with Windows and Mac OS X applications. The iOS form has specific hardware-dependent properties.

How do I create a mobile app in Delphi?

To accomplish this, you create a new mobile app, write one or more lines of code, the Project | Deployment menu item and use the System.IOUtils unit’s TPath.GetDocumentsPath method and PathDelim in your code. 1) File | New | FireMonkey Mobile Application – Delphi and used the “Blank Application” project template.

Where can I find the Delphi interface to iOS frameworks?

The VCL is available only on Windows (32-bit or 64-bit). The RTL contains a number of units that provide Delphi interfaces to iOS frameworks written in Objective-C. These units are scoped with iOSapi and are typically located in the /source/rtl directory of your product installation:


1 Answers

Around 15 MB sounds to be the smallest executable size with Delphi for iOS (in Release mode with no debug info). You can try to disable the RTTI generation, if you do not need it. But not with a lot of hope.

It is much bigger than ObjectiveC "native", but it embeds the whole Delphi RTL and the FireMonkey libraries to do all the rendering, therefore it is bigger.

A "plain Objective Pascal" executable using native iOS controls, compiled with FPC, should be smaller. Or when compiled with "Oxygene for Cocoa", it should be much smaller.

But do not look only at executable size, think at the memory used during execution, and general speed. You may have to compare with HTML5 apps embedded with PhoneGap. FireMonkey may be slower at rendering on screen, but native code with ARC memory handling should be more powerful than JavaScript.

Do not forget that your smartphone has now a lot of memory. ;)

Sadly, it is not possible to share some code with external libraries (.so) under iOS, so you won't be able to use something like Delphi packages to reduce the executable size.

Of course, Apple has always done everything in its power to force developers to use its own tools and language. As does Microsoft, especially for Windows 8. Delphi for iOS does not claim to be better than XCode + Objective C, but to be cross platform so that you can share as much code as possible with your server or Windows / Mac OSX apps: you can not use your Objective C code outside the Mac world... but you can share your Delphi code among platforms, even if the UI has to be rewritten for mobiles. This is why a more fair comparison would be with JavaScript/PhoneGap, MonoDroid/MonoTouch or AppCelerator.

Some data, retrieved from StackOverflow:

  • Objective C : 50 KB;
  • PhoneGap: 5 MB under iOS - 200 KB for Android;
  • MonoTouch: 5 MB;
  • AppCelerator: 5 MB.

One concern: AFAIK the size limit for 3G download in the AppStore is about 20 MB.

like image 177
Arnaud Bouchez Avatar answered Sep 21 '22 12:09

Arnaud Bouchez