From REST to Database

There are frequently questions about how to get the results of a REST query (JSON) into a database table. This can of course be done manually, by using the „while not EOF do“ approach, but there are actually components in Delphi that make this job relatively easy and flexible.

So I created a video, demonstrating how to take the JSON response of a REST request and insert it into a database table.

I am using TFDMemTable, TFDQuery, and TFDBatchmove to move the data from the original TRESTResponse into an SQLite table – just by using FireDAC components.

Source code is available on BitBucket.

Publishing Delphi Apps to the Microsoft Store

In this video, I will guide you through the steps to get your Delphi app published in Microsoft’s App Store. For this demonstration, I will use a Firemonkey app, but technically the same thing would work with VCL apps as well.

This is the appx that I published and got certified by Microsoft. It’s a simple Hash calculator. Nothing too fancy, but useful enough to successfully pass Microsoft’s verification procedures: Microsoft Store – HashExpert

Delphi CE Bootcamp 2018: Threading and Performance Tuning

Last week I had my „Threading and Performance Tuning“ lecture at Embarcadero Academy. It was an interesting experience and it looks like I’ll be using that platform for more courseware in the near future.

So if you are interested in how to work with TThread and TTask in Delphi, then feel free to checkout my lecture at Embarcadero Academy.

Below is the replay of the live Q&A session, which is a good teaser on what to expect in the full lecture. (The sound is a little bit flakey, as it was recorded live. The actual lectures have better sound)

 

Bessere Performance mit REST Kompression

Viele Delphi Anwendungen, speziell mobile iOS oder Android Apps, verwenden REST, um an ihre Daten zu gelangen. Häufig werden dazu TRESTClient und TRESTRequest eingesetzt, insbesondere wenn auf eine externe RESTAPI zugegriffen wird. Dies wird in einigen Blogs oder CodeRage Beiträgen (auch von mir) demonstriert. Zum Nachlesen findet sich auch in der Delphi Dokumentation ein einfaches Tutorial:

Delphi Songsterr REST Tutorial

Den meisten dieser Beispiele ist eines gemeinsam: Sie sind unnötig langsam!

Read More

CodeRage 3: Video – iOS Apps mit Schlüsselbund verbinden

Vergangene Woche haben wir mit Embarcadero Deutschland erfolgreich die nunmehr dritte Coderage über die Bühne gebracht.

Hier findet ihr sämtliche Webinare zum nächträglichen Anschauen. Vielen Dank an Matthias Eissing – für die nicht unerhebliche Arbeit und auch die Geduld, alle Videos der Sprecher einzusammeln und aufzubereiten.

Hier mein Beitrag, der zeigt, wie man in FireMonkey iOS Apps den Apple Schlüsselbund aktiviert, um bei Login-Feldern dem Benutzer die Arbeit zu erleichtern. Den in der Session erwähnten Quelltext findet ihr hier.

Read More

Signieren von Windows Delphi Anwendungen

FireMonkey Apps für iOS und Android werden in Delphi im Rahmen des Bereitstellungsprozesses automatisch signiert – dies ist inbesondere für iOS Apps unabdingbar und wurde daher in der Delphi IDE auch entsprechend umgesetzt.

Bei Windows Anwendungen (egal ob 32 oder 64 Bit) ist dagegen keine Signatur-Option in Delphi zu finden. Dies dürfte dazu führen, dass viele Delphi Apps unsigniert verteilt werden. Dies ist jedoch spätestens seit Windows 10 nicht mehr zu empfehlen, denn der mit Windows 10 eingeführte „SmartScreen-Filter“ blockiert standardmäßig „nicht vertrauenswürdige“ Anwendungen. Eine unsignierte Anwendung (EXE) ist per se „nicht vertrauenswürdig“, da ihre Herkunft nicht verifiziert werden kann.

Read More

Setting the correct Xcode build number for Delphi FMX Apps

If your Xcode version updates (manually or by Apple’s updating mechanism) then make sure to re-import the iOS/macOS SDK from within Delphi.

To build and deploy iOS/macOS apps with Delphi, you need Xcode for the final steps, even though the actual binary is compiled by Delphi. Apple frequently delivers minor updates to Xcode. Current version as of the writing of this article is 8.3.2. This version number of the Xcode build used for preparing apps is apparently checked by Apple, when uploading an IPA file to App Store/iTunes Connect. They don’t do any spooky things, they just check the DTXcodeBuild key in your app’s info.plist file:

 

This info.plist file is generated by Delphi, and contains various essential settings, such as version number, device requirements etc. Many of these settings can directly be configured, by modifying the values in Delphi – Project – Options – Version Information

DTXCodeBuild is filled in by Delphi automatically though. When you import iOS/macOS SDK, then PAServer obviously issues this command:

/usr/bin/xcodebuild -version -sdk

That returns the available SDK versions and the Xcode build number:

iPhoneOS10.3.sdk - iOS 10.3 (iphoneos10.3)
SDKVersion: 10.3
Xcode 8.3.2
Build version 8E2002

This build version number is apparently stored and used to fill the DTXcodeBuild key’s value.

To bring this number in Delphi in sync with the actual Xcode version, after Xcode was updated (or switched with xcode-select), you have to delete the SDK from Delphi and re-import it using Delphi – Tools – Options – SDK Manager.

This is especially important if you imported the 10.3 SDK while having Xcode 8.3.0 installed. In that case your Delphi iOS apps would be tagged with being built with exactly that version – no matter if you downgraded to Xcode 8.2.1 or applied my „Package Application fix“ – which is required due to a tool chain change that Apple imposed with Xcode 8.3 and up. Any iOS app tagged with being built with Xcode 8.3.0 will be refused by Apple, as that version has been deprecated.

Delphi and Xcode 8.3.x deployment solution

Since Apple updated Xcode to version 8.3.x, iOS IPA deployment is broken with Delphi up to 10.2 (Tokyo). There is an official workaround, which basically instructs to download Xcode 8.2 and use that for now:

http://docwiki.embarcadero.com/PlatformStatus/en/Main_Page#iOS_10

Unfortunately though, Apple started sending out notifications, that it won’t accept any builds created with Xcode versions older than 8.3.2 anymore. This is what I’ve received from Apple a few days ago:

„Dear developer,
We have discovered one or more issues with your recent delivery for „AppEvents“. Your delivery was successful, but you may wish to correct the following issues in your next delivery:
Deprecated Xcode Build – Due to resolved app archives issues, we will be deprecating Xcode 8.3 on May 10, 2017, at which time app archives built with 8.3 will no longer be accepted by the App Store. Download Xcode 8.3.2 or newer, rebuild your app and resubmit.
After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.
Regards,
The App Store team“

The problem with Delphi and Xcode 8.3 is basically a tool, that Apple decided to remove from its tool chain, but which Delphi still depends on. So the solution is to copy that missing tool „PackageApp“ from 8.2 to 8.3. Below are the steps that made my Delphi 10.2 (Tokyo) iOS deployment fully working again:

  1. Install current Xcode from Appstore into your applications folder – currently 8.3.2
  2. Download Xcode 8.2.1 from
    https://developer.apple.com/download/more/
  3. Unzip Xcode_8.2.1.xip to a separate folder (e.g. /tmp/Xcode)
  4. Make a backup copy of your current Xcode version:
    cp -R /Applications/Xcode.app /tmp/Xcode.8.3.app (might take a minute or two)
  5. Copy the following file from 8.2.1 to your current Xcode app:
    sudo cp /tmp/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
Wir benutzen Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu.