Friday, 8 June 2012

FireMonkey iPhone/iPad links and info

This week’s instalment of the UK-based Developer Direct webinar series is called iPhone/iPad Development with RAD Studio XE2. The following is a set of links and general information picked up during that broadcast and also during a US webinar by Anders Ohlsson (broadcast during the week and presumably to be available as an on-demand webinar after the fact) entitled Create Mobile iOS Apps using Delphi XE2 with FireMonkey.

Links:

Info:

  • iPhone and iPad run an operating system called iOS, the current version of which (at the time of writing) is 5.1.1.
  • RAD Studio runs on Windows. iOS development requires use of a Mac and also Apple’s Xcode development suite (this gives you the iPhone/iPad simulator and various tools to sign and package the app correctly).
  • Additionally, the current toolset requires an intermediate step involving the FreePascal Compiler (FPC) inside Xcode to build (and debug) the iOS app. This is a temporary initial situation while waiting for Delphi to be able to target ARM processors.
  • Caution: FPC is case-sensitive in terms of the uses clause!
  • To target latest iOS and have all the bits you need, you need:
    • a Mac with OS X 10.7.x (known as Lion) running.
    • Xcode 4.2 (a slightly older version of Xcode that installs appropriate required command-line tools) installed on the Mac. You can get this from Apple’s Developer Downloads page (requires an Apple ID)
    • Install on the Mac the packages from FireMonkey-iOS.dmg (installed by RAD Studio / Delphi on your Windows machine into a FireMonkey-iOS folder) to get:
      • FreePascal Compiler (FPC), required to build your iOS app from within Xcode
      • FireMonkey iOS Libraries – required files that FPC needs to build the iOS app on the Mac
    • Xcode 4.3 – most recent update of Xcode, which supports the more recent iOS releases (5.x). Also worth noting that 4.3.x does not install some required command-line tools by default. One benefit of having installed 4.2 first is that you will have these tools installed. That said, you can download them in isolation from Apple’s Developer Downloads page (requires an Apple ID)
    • Modify one of the iOS FMX support files, as per Anders’ post
    • Install Anders’ iOS components into RAD Studio
  • To get Xcode you need to join the Apple Developer Program (free). To deploy apps to a real device (iPad or iPhone) as opposed to the simulator, you need to join Apple’s iOS Developer Program ($99 per year to Apple) and create a Development Provisioning Profile. To deploy an app to the Apple App Store you need to create a Distribution Provisioning Profile. Plenty of information can be found in the RAD Studio documentation.
  • When writing iOS code in Delphi XE2 these directives instruct the Free Pascal Compiler to support Delphi and Objective-C language features:
      {$ifdef FPC}
        {$mode delphi}
        {$modeswitch objectivec1}
      {$endif}
  • When Delphi targets ARM, the FreePascal dependency will be removed, as will the need to use the Xcode IDE. However some Xcode command-line tools will still be required on the Mac for signing, packaging etc. since Apple does not license these tools to third party tool vendors.
  • iOS development from RAD Studio XE2 with FireMonkey is currently Delphi-only. C++ iOS support is pending, as per the recently published C++ roadmap. As soon as the C++ compiler targets ARM, then C++ will also directly generate iOS applications.
  • When Delphi and C++ target ARM7, FireMonkey applications will support both iOS and Android directly from the IDE via new Target Platform options.
  • Simplistic way of ensuring a screen full of controls laid out for an iPhone screen will fill up an iPad screen is to place all the controls on a TScaledLayout, perhaps with Align set to alFit as opposed to alClient.
  • iOS apps should not proactively exit – they should only exit in response to the Home button. If you force an exit your app will likely not be approved by the Apple app review board.
  • After creating an iOS app in Delphi XE2 you must also export it for Xcode consumption using dpr2xcode. This exported Xcode project needs to be available to Xcode on the Mac, so some shared drive is a sensible location to save the project to in the first place. A common way of working is to have Windows (and the RAD Studio/Delphi IDE) running as a guest OS in some VM software on the Mac (where OS X is the host OS), and storing the project in a directory that is shared between the host OS and guest OS. You could use commercial VM software such as VMWare Fusion or Parallels or even the Open Source VirtualBox.

Saturday, 2 June 2012

Problems deleting assemblies from the GAC

I have occasional need to do this and, when I try and delete an item from the GAC using the Windows Explorer view (by navigating to %windir%\assembly) I always get ‘Access Denied’ errors. So to save me the age it always seems to take me to find how to overcome this each time I need to, I’ll write it here.

This requires a local security policy to be altered. Run the local security policy MMC (just start typing ‘local’ in the Windows Start menu search box) and navigate down through: Security Settings, Local Policies, Security Options and change the ‘User Account Control: Run all administrators in Admin Approval Mode’ entry to Disabled.

Now restart Windows, delete any GAC assemblies you like, reload the local security policy MMC so you can revert the policy to Enabled (and then restart again) and you’re done.

An alternative ‘sledgehammer vs. nut’ approach is, apparently, to disable User Account Control.

Friday, 1 June 2012

Mac Development links/info

This week’s instalment of the UK-based Developer Direct webinar series is called Mac Development for Windows Developers, focusing on the Mac aspects of the cross-platform development capabilities of RAD Studio XE2. The following is a set of links and general information picked up during the broadcast.

Links:

Info:

  • FireMonkey (typically abbreviated to FMX) is in essence a cross-platform alternative to the Windows-only VCL. VCL is the Visual Component Library, where many of the components are wrappers around Windows-supplied controls. FireMonkey targets multiple platforms and so doesn’t wrap OS controls or capabilities per se, but creates them from scratch using OS awareness, styles, etc. FireMonkey is described by Embarcadero as a Business Application Platform.
  • FireMonkey supports HD or 3D applications. A HD app is like a traditional Windows form containing controls that are familiar in business applications. a 3D app is a 2D view on a 3D world and so is more suited to 3D graphics scenarios.
    When creating either, the choice affects the form created in the application. However a FireMonkey HD form (a TForm) can make use of FireMonkey 3D components (using a TViewPort3D), and a FireMonkey 3D form (a TForm3D) can make use of FireMonkey HD components (using a TLayer3D, as discussed in the documentation). See this part of the documentation for details.
  • Ctrl+. is the keystroke to get IDE Insight – the incremental search across much of the IDE’s content including components, environment options, project options and more.
  • paserver (Platform Assistant Server) needs to run on OS X to allow RAD Studio’s 32-bit Windows-based IDE to start and communicate with (i.e. launching & remote debugging) an app built and deployed to another target platform, e.g. 64-bit Windows or Mac OS X.
  • When compiling a multi-platform project, each target has its own output subdirectory within the project directory tree, namely: Win32, Win64 and OSX32.
  • Action lists, audio and video are not currently supported in FireMonkey but these are things that are being worked on for future versions.
  • Mixing FMX & VCL integration in an application must occur through dynamic linking; it won’t pan out well if you try and use static linking.

RAD Studio XE2 for the price of Delphi XE2 or C+Builder XE2

Embarcadero are pushing out deals at the moment. In addition to the C++Builder bundle deal written about here, here’s the latest one I’ve bumped into: for the month of June 2012 if you buy either Delphi XE2 or C++Builder XE2 (new user or upgrade, Professional, Enterprise, Ultimate or Architect edition) and you get the full equivalent edition of RAD Studio XE2.

So, in addition to the originally purchased Delphi or C++Builder, you also get the other one of those two, in addition to Embarcadero Prism XE2.5 (aka Oxygene for .NET 5.1) and RadPHP XE2.

You can find what’s new in Prism XE2.5 either on the Oxygene section of the RemObjects web site or in marc hoffman’s blog post. In short you get support for building Metro apps for Windows 8, mapped types, flow control analysis and the neat async future await keyword.

Full details of the deal are available here.