Tag Archives: ios

Hands on with Delphi XE2 for Apple iOS

Last week Embarcardero released RAD Studio XE2. RAD Studio is the suite of tools based on Delphi, a language – originally called Object Pascal – and visual development tool which still has a loyal following. XE2 is the most interesting new release for years, introducing a 64-bit compiler for Windows and cross-platform support for Apple’s OSX and iOS.

I have been trying the final release, paying particular attention to the iOS support, bearing in mind the importance of Apple’s mobile platform. The RAD Studio IDE only runs on Windows, so the most convenient way to target Apple’s platform is to install on a Windows virtual machine. I used a Parallels VM running Windows 7 64-bit, hosted on OS X Lion.

Setting up for iOS development with RAD Studio XE2 involves several steps. First, you have to use the new FireMonkey application framework in order to do cross-platform work. FireMonkey emerged after Embarcadero acquired the intellectual property of a company called KSDev early in 2011, along with its founder Eugene Kryukov:

KSDev’s intellectual property has been purchased by Embarcadero Technologies, the makers of Delphi and C++Builder Rapid App Development Tools. I am excited to announce that I have joined Embaracadero’s next gen frameworks team leading a very exciting project. As a result I will no longer operate the KSDev company and will not be accepting any further orders for KSDev products.

The products in question were Delphi frameworks called VGScene and DXScene, and these seem to have been melded with remarkable speed into what is now called FireMonkey. FireMonkey controls such as buttons and listboxes are all custom drawn, which is good for cross-platform consistency, but bad if you want your application to look and feel truly native. FireMonkey is not compatible with Delphi’s VCL (Visual Component Library), though the basic controls like TButton and TEdit are similar. FireMonkey applications can be either 3D, with the emphasis on Flash-like visual effects, or HD, used for more traditional user interfaces.

Support for Mac OSX is more fully integrated than for iOS. You can easily add an OSX target to a FireMonkey application, but for iOS you have to create a new application that only targets iOS. Another difference is that Embarcadero has its own Mac compiler, whereas the iOS support depends on the FreePascal open source compiler. If you are targetting OSX, you can code and debug entirely from the Delphi IDE, whereas for iOS you have to export your project and compile in Xcode.

In order to prepare for iOS development, you first need a Mac with XCode and the iOS SDK installed. Next, install RAD Studio XE2 on Windows. Then find the FireMonkey-iOS folder in the directory where RAD Studio XE2 is installed. This contains FireMonkey-iOS.dmg. Copy this to the Mac side, mount it and run the FireMonkey iOS installers to add FreePascal and the FireMonkey libraries to your XCode setup.

image

If you are also doing OSX development you will also need to install the Platform Assistant on the Mac, but for iOS this is not required.

Now you can go over to the Windows side, start a new application observing all the tasty new options, and choose a FireMonkey HD iOS application.

image

This creates a new form sized for an iPhone 4.0, though of course you can amend this. There is a tool palette which looks well-stocked with components, but note the following warning:

While you are designing your iOS application, you can only use components that are supported on iOS devices. However, the Tool Palette might contain components that are Windows-only or otherwise not supported on iOS.

That is an annoyance, and contributes to a feeling that iOS support is a little, dare I say, unfinished. Still, undaunted I built my sample app, following the path I have trodden before by creating a simple calculator.

image

You might wonder why all the buttons are green. I did, too, and played around a little trying to change it. This seems to involve creating a custom style. I started doing this, but decided it was not necessary for my simple test. It does make the point that the default appearance does not have the iOS look and feel.

There is what seems to me a small bug in the designer. If you select more than one control, the sizing tabs disappear and there is no visual evidence that the controls are selected, other than a heading in the Object Inspector that reads “n items selected.” At first I thought it was impossible to select more than one control, but this is not the case. However, there is no clipboard support in the visual designer. For example, if you want several buttons that are exactly the same, you need to add them individually, then multi-select and set the properties as needed.

While developing an iOS app, you can test it by running it on Windows within the IDE. When it is ready to test on iOS, you need to export the project. To do this, you need a command-line tool called dpr2xcode.exe, which is in the RAD Studio bin folder. Running this from the command-line is inconvenient, so the usual approach is to use Configure Tools from the Tools menu to add it to the IDE.

image

It is puzzling that Embarcadero has not included this by default.

Running the tool creates an xcode sub-folder in your project directory, with an .xcodeproj project file along with some default icons. I then copied the entire project folder to the Mac. It is also possible to use a shared folder accessed from both Windows and Mac, though I found this does not work if the folder is on the Windows side, so I simply copied it back and forth.

I opened the project in Xcode, and was prompted to “Modernize” it in Xcode jargon, to no ill effect. At this point I could successfully build it and run in the iPhone emulator.

Of course I wanted to test it on an actual device. I attached an iPhone 4 and did the Apple provisioning dance. After the usual messing around with certificates, it worked.

image

and here it is on the iPhone:

image

It works, and to that extent I am impressed. That said, I am disappointed with the performance. This is subjective, but I am talking about the responsiveness of the UI. There are perceptible pauses, which for such a simple app is surprising. I have created this same app numerous times using different development tools, and had expected that the Delphi version would be up there with the best, but while it is acceptable it is less responsive than some of the others.

Let me add though, a Delphi developer will find the process described above a easier than learning Objective C, and I was able to create this fully working app in an afternoon so I should not complain too much.

Maybe when Embarcadero comes up with its own iOS compiler there will be some improvement.

Adobe says role of Flex and Flash has changed, makes play for mobile

Adobe’s Andrew Shorten has posted on the future of Flex, the developer-oriented tool for building applications for the Flash runtime.

This is one of the clearest statements I have seen from Adobe that recognises that the role of Flash on the web is diminishing:

There are countless examples where, in the past, Flex was (rightly) selected as the only way to deliver a great user experience. Today, many of those could be built using HTML5-related technologies and delivered via the browser, and at Adobe, we will provide tooling to help designers and developers create those experiences – Edge and Muse are two such examples.

Adobe is not giving up on Flash, of course, and states that it is still the best for certain categories of application:

We firmly believe that Flex is already the best technology for building complex, high fidelity enterprise applications such as business dashboards, line of business tools, real time trading applications and desktop replacement applications.

I would add both statements are written from the perspective of application developers. The role of Flash as a video and multimedia player is a separate issue. Flash is also important in that context. There is some overlap, in that if your application includes multimedia content then Flash is correspondingly more attractive.

As an aside, it is interesting to note that this repositioning of Flash makes it not so different from Microsoft’s Silverlight: a runtime for business applications.

Adobe is focusing on a new market for Flex in mobile. This overcomes the Apple iOS problem, since you can compile a Flex application to iOS native code. Adobe promises “additional mobile development capabilities” later this year and says:

In our next major release timeframe we expect that the need to build a fully-native application will be reserved for a small number of use cases.

I agree that cross-platform mobile development is a key area and one where there is no clear winner yet. It is a good opportunity for Adobe, though there is increasing competition from the products like Appcelerator Titanium and PhoneGap.

I also think that Embarcadero’s new RAD Studio XE2 will attract interest. This tool which will be released soon does native code compilation across Windows, Mac and Apple iOS, with Android promised, using the Delphi IDE and language.

Kingston Wi-Drive: portable storage expansion for iPad and iPhone

Kingston has announced availability of the Wi-Drive. This product addresses an annoying limitation of the Apple iPhone and iPad: no USB port for external storage devices.

The Wi-Drive overcomes this by connecting wirelessly. It offers 16GB or 32GB of solid-state storage, with USB for charging and for access to the files from a PC or Mac. When you are on the go, you can put the Wi-Drive into your pocket. A free app on the iPhone, iPad or iTouch lets you access the files. The use of a network bridging means you can still access the internet. Battery life is said to be up to 4 hours, so I hope you can switch it off when not needed. You can also share the drive with up to three other users.

Example prices are £89.99 for the 16GB or £124.98 for the 32GB version.

It is a clever solution. That said, I have a couple of reservations. One is that the price is high compared to a simple USB device of the same capacity. That is not unreasonable given the extra technology needed, but it means it will only sell to users who really need it.

And do you need it? If you are on the internet, you could use a file synchronization service like Dropbox, or Apple’s own iDisk or forthcoming iCloud, to extend storage instead.

A second problem is that iOS does not expose its file system to the user. This means that external storage is less convenient on iOS than on other systems. Want to save a Pages document from iOS to the Wi-Drive? You probably cannot do so directly; there is no way to save direction to Dropbox either.

The Wi-Drive only exists because of Apple’s desire to control and supposedly simplify the operating system. It is a workaround, but not a perfect one, although that is not the fault of Kingston.

That said, I have not yet tried a Wi-Drive; I hope to bring you a proper review in due course.

An iOS security tip: tap and hold links in emails to preview links

Today I was using an iPad and received a fake email designed to look as if it were from Facebook. It was a good imitation of the Facebook style.

image

In particular, the links for sign in look OK.

Outlook on Windows displays the actual link when you hover the mouse pointer over the link. As you can see, in this case it is nothing to do with Facebook:

image

How do you do this on iOS? There is no mouse hover (though it could be down with a proximity sensor) but if you tap and hold on the link, iOS pops up a dialog revealing the scam:

image

Worth mentioning as tapping and holding a link to inspect it is not obvious and some users may not be aware of this feature.

The iPad is still worse than Outlook for email security. Outlook does not download images by default. Downloading the image tells the spammer that you have opened the message:

image

The iPad mail client downloads all images.

image

In mitigation, most malware on web sites will not run on iOS. However you could still give away your password or other information if you are tricked by a deceptive web page or fake login.

Hiding links is a feature built into HTML. The designers of HTML figured out that we would rather see a friendly plain English link than a long URL. Unfortunately this feature, and related ones like the ability to make an image a link, play into the hands of the scammers and it is necessary to look at the real link before you follow it.

A better solution would be authenticated email, so that fake Facebook emails would be detected before they are displayed. Unfortunately we are still a long way from using authenticated emails as the norm.

Delphi for Windows, Mac and iOS: screenshots and video of cross-platform development

Embarcardero is drip-feeding information about its forthcoming RAD Studio XE2 in an annoying manner; nevertheless the product does look interesting and promises cross-platform native code apps for Windows 64-bit, Windows 32-bit, Mac OS X and Apple iOS. I have grabbed some screens from a video recently posted by Embarcadero’s Andreano Lanusse; the video is also embedded below.

Here is Delphi XE2 showing a FireMonkey application in the designer. FireMonkey is a new cross-platform GUI framework.

image

Note the list of target platforms on the right. If you squint you can see 64-bit Windows, OSX, and 32-bit Windows.

image

How do you compile for the Mac? It is clear from the demo that Lanusse is running in a VMWare virtual machine on a Mac. He also has a Remote Profile option set to target the host Mac:

image

He then refers to a “Platform assistant” which you can see running in a terminal window on the Mac.  He is then able to compile and run from the Windows IDE:

image

Finally, he targets iOS, though this is a separate project, not just another target. The process exports the project to Xcode, Apple’s Mac and iOS IDE:

image

Next, we see the app running on the iPad simulator:

image

The ability to target the Mac is nice to have, but I suspect it is iOS that will attract more interest, given the importance of Apple’s mobile platform.

Here’s the complete video where you can perhaps puzzle out a few more details.

Update: there is also some Q&A in the comments here.

Graphics rendering is Direct2D or Direct3D on Windows, OpenGL on Mac. FireMonkey renders all components through the graphics API, it does not support use native OS components, though Embarcadero’s Michael Swindell says:

FireMonkey client area controls are rendered by OpenGL on Mac, but appear and work just like Cocoa controls – or however you want them to. There are many different Cocoa UI styles in OSX apps, and Firemonkey can render any of them – including iTunes, or Prokit which is an Apple UI style for Pro apps like Final Cut, not available to devs via Cocoa. Windows are Cocoa Windows and the client areas and all user controls are rendered by OpenGL in HD(2D) or 3D. Menus are std and rendered by Cocoa in the menu bar, and common dialogs are rendered by Cocoa. If the “true OSX” look isn’t for you, you’re welcome to use any included Style, download a custom style, or create your own custom style.

Swindell also addresses the matter of Linux and Android:

We do plan Linux and Android. But no eta yet until we get Win/OSX/iOS out. We would also like to provide language bindings for other languages.

Finally, a bit more about that Platform Assistant:

Developer requires a PC and a Mac (or Mac with VM running Windows). You will develop on Windows, and use the platform assistant (PA running on your Mac) to compile natively to your Mac and the PA handles debugging communication between the Mac and your IDE running on Windows. Delphi (or C++Builder) and Firemonkey create compiled stand alone OSX executables that you can sell/distribute to your users. They are native Mac apps. They “copy install” and run like any other Mac app, or you can use a Mac installer if you like.

Living in an App Store world: what are the implications?

A few recent events prompt some reflections on the rise of app stores and the implications for developers and for the IT industry.

One is Apple’s OS X Lion release, available only through the Mac App Store; and the removal of the optical drive on the Mac Mini, making it hard to install shrink-wrap software.

Another is Adobe’s closure of its InMarket service and AIR Marketplace app store. Some app stores are doing better than others.

A third is TechCrunch reporting that book apps such as Nook and Kindle are being hobbled or removed from the Apple iOS store. While I cannot verify this at the moment – I still see the Kindle app in the store, and it still has a link to the Kindle web store – it is in tune with Apple’s announcement in February:

… publishers may no longer provide links in their apps (to a web site, for example) which allow the customer to purchase content or subscriptions outside of the app.

Enforcing this on an app such as Kindle promotes Apple’s own iBooks app and store.

There are lots of app stores out there, though one fewer with the forthcoming closure of AIR Marketplace, but how many of them matter? Here is my pick of the top three:

  • Apple iOS and Mac App Store – arguably two different stores, but since you access them with the same account I bracket them together.
  • Google Android Market – not a lock-in like Apple’s store, but still the primary store for Android.
  • Windows vNext marketplace – how this will work is not yet public, but the existence of a new app store in Windows 8 is widely rumoured and might be expected to tie in with what is already in place for Windows Phone 7.

Perhaps I am overstating the importance of the Windows 8 marketplace, given the failure of the Windows Vista marketplace, but given that Apple has now shown the way I find it hard to see how Microsoft can fail with this one.

Note that an app store is not just a marketing ploy. It is a software deployment and update tool.

App Stores score well in terms of usability. Another advantage is that users have a centralised mechanism for software updates, managed by the operating system. That is good for security, because it is unlikely to be disabled, and good for usability as it should mean fewer third-party updaters like those from Adobe, Oracle Java, Symantec and others.

App Stores typically enforce certain conditions on developers. In essence they must be well-behaved. For examples, the Mac App Store prohibits apps that request escalation to root privileges. Apple also rejects apps that use “deprecated or optionally installed technologies”, including specifically Java and by implication Adobe Flash or other runtimes.

This is great for security. In principle, if you decide that you will only install apps from the App Store, you can be confident that all your apps are well-behaved. On the Mac this is interesting; on Windows it would be a revolution.

What are the business implications though?

  • First, it is a significant source of new revenue for the operating system vendor. It gets a cut of everything.
  • Second, it gives tremendous empowerment to user ratings and reviews. On iOS or Android, if you want an app, you automatically search the app store and take note of factors such as user ratings and popularity. Most of us can figure that if there are few ratings or reviews, the app is not popular.

If you are a software company, getting high ratings and good reviews on app stores is now a key challenge, even more so than it is already with the likes of Amazon.

  • Speaking of Amazon, the third point is that app stores will not be welcomed by software resellers. They are simply being bypassed. Amazon is addressing this with its own App Store for Android; but can it really win against the official Google Android Market? Its MP3 store is better value than Apple’s iTunes, but has smaller market share.

Amazon has other business to fall back on, but specialist software resellers will be watching the growth of app stores nervously. Apple resellers in general are already hurting and diversifying, thanks in part to Apple bypassing them with releases like OS X Lion.

The app store revolution is good for users in many ways, especially as prices seem to end up lower than before, but there are worrying aspects. In particular, the ability of the operating system vendor to tilt the store in its own favour is a concern, and we will hear more complaints about that.

Finally, it is interesting to speculate how this may impact enterprise software deployment. Will Microsoft aim to link its forthcoming Windows app store to other deployment mechanisms such as System Center Configuration Manager? What about volume licensing sales, will resellers be able to keep hold of those? Maybe we will learn more of Microsoft’s story on this at the Build conference in September.

Adobe releases 64-bit Flash Player 11 beta, AIR 3 with packager for Windows, Mac, Android

Adobe has released a beta version of Flash Player 11 and AIR 3. The AIR release is of limited interest since as yet there is no public SDK; Adobe mainly wants to test compatibility.  That said, the announcement describes a key new feature, the ability to package AIR applications as standalone executables on Windows, Mac and Android. You can already do this on Apple iOS, a feature that was forced on Adobe by Apple’s refusal to allow application runtimes on iOS – unless they are WebKit or FileMaker. This is new for the other platforms though, and I assume comes as a result of the popularity of the iOS packager. The effect is that you no longer have to advertise the fact that your app runs on AIR or require users to obtain the runtime; your app will just work.

Adobe may have its eye on the Mac App Store, which will disallow applications that require a runtime. Extending the AIR packager to desktop OS X should get around that limitation.

64-bit Flash Player is also a big deal, and really long overdue, though there has already been a preview codenamed Square which offered 64-bit. Although there are probably not many Flash applications that really need 64-bit, this is good for compatibility with 64-bit browsers and of course desktop applications when compiled with AIR. There could also be value in 64-bit for business intelligence clients which manipulate large datasets.

Another new feature in Flash Player 11 is Stage3D, codename Molehill, which is a new API for hardware-accelerated 3D graphics. Stage3D has its own shader language, called AGAL (Adobe Graphics Assembly Language); my heart sinks a little when I see vendors inventing new languages rather than using one that is already available, such as OpenGL Shading Language, but Adobe says AGAL is simpler and more secure. If you would like to use GL SL with Stage3D, check out the 3rd-party Mandreel framework which comples GL SL shaders to AGAL.

Flash Player 11 also has a built-in H.264/AVC software encoder for cameras, which will improve video chat and video conferencing, and adds potential for applications that stream video out as well as in.

Native JSON support will simplify and accelerate the handling of data in this popular format.

Another feature that caught my eye is socket progress events. When transferring data, it is important to give feedback to the user on progress. A new property lets developers monitor the number of bytes remaining in the write buffer, and a new event is raised when data is being sent, enabling more informative data transfer applications.

LZMA compression for SWF files, the compiled format for Flash content, is claimed to reduce SWF size by up to 40%.

When do we get a full release? Adobe is taking its time, but my hunch is that it will be in 2011, maybe in time for the MAX conference in October.

Embarcadero promises Delphi everywhere: Mac, iOS this year, Android, Blackberry, Windows Phone to follow

I noticed the following remark from Embarcadero’s David Intersimone regarding Delphi, its application builder based on Pascal.

We are putting Delphi (and C++Builder) everywhere this year and over the next 5 years. Today you can use Delphi for Desktop, Client/Server, Multi-Tier, Cloud, Web, Web Services (REST and SOAP). This year you will also be able to build for Macintosh and iOS. Linux is also on the roadmap for the coming years along with Android, Blackberry and Windows Phone 7.

Welcome news; though Delphi enthusiasts are all too familiar with bold promises. Two years ago I interviewed Embarcadero’s CEO Wayne Williams and he promised cross-platform Delphi in 2010; but when Delphi XE appeared last year neither Mac nor 64-bit (another longstanding request) was included.

That said, I am still a big Delphi fan. Mobile is a particularly interesting prospect. I have tried numerous cross-platform mobile toolkits and they all have problems; on the other hand they are improving fast and in a couple of years things like Appcelerator’s Titanium and  Nitobi’s PhoneGap may be hard to catch.

Update: what will Delphi’s Android support look like? I would be interested to know whether Embarcadero is working on its own compiler, or whether it is partnering with RemObjects and that what Intersimone is referring to is Project Cooper:

“Cooper” is a new and exciting research project going on in the RemObjects Software Labs, to bring the Oxygene language to the Java and Android platforms. The original Oxygene for .NET set out to bring a modern and “next generation” Object Pascal to the .NET world; Project “Cooper” is taking this endeavor to the next level, expanding the reach of Oxygene to the second big managed platform.

In other words, Project Cooper will compile Delphi code to Java.

Note that Embarcadero officially adopted Oxygene and offers it as its own product called Prism. It seems plausible that the same will happen with Project Cooper. Since Windows Phone is a .NET platform, there is also potential for Oxygene/Prism to target Microsoft’s mobile platform:

Windows Phone 7 – Microsoft’s new Windows Phone 7 uses Silverlight for application development,  and did I mention Delphi Prism does Silverlight?

says Jim McKeeth at RemObjects.

What about Delphi on the Mac and on iOS? There is also a possible Oxygene/Prism route here, via MonoMac: Delphi to .NET/Mono to Mac. However, I suspect Delphi developers would be disappointed if this turned out to be Embarcadero’s approach to Mac and iOS support. Programmers choose Delphi because they like compilation to native code.

Google Plus demands your location on iPhone, iPad and mobile devices – but you still have control

Last week I signed up for Google + (you can find me here), and one of first things I tried was to sign in on an Apple iPad.

I was annoyed to see the following message:

image

Google demanded the right to use my location with Google Plus, otherwise it would not let me sign in. But what if you want to use Google Plus without sharing your location with the world? Since Google Plus works fine on desktop PCs without location information, why should you not use it on an iPad in the same way?

This led me to investigate the W3C Geolocation API. In fact, I wrote my own web page to test how it works. I went over to Bing Maps, signed up for a developer account, and wrote a small amount of JavaScript to test it. You can try it here if you have a reasonably modern browser. I have not bothered to test for older browsers that do not support geolocation.

You will notice a couple of things about this test page. One is that it will ask your consent before attempting to retrieve your location. Another is that on a home broadband connection, it is rather inaccurate. According to Internet Explorer 9 I am in Berkhamsted – do not try and visit me there though, I am nowhere near.

image

However, if you try this on an iPad or other mobile device, you will likely get much better results. If I use the iPad, even on home wifi, it shows my house dead centre of the map.

That is only if you give consent though. Since Google + is a web application, this consent is determined by Safari, irrespective of what terms and conditions you agreed with Google. If it bothers you, you can even go to settings – location services and disable them for Safari completely:

image

That said, Google could add some code that tried to retrieve your location and would not let you use Google+ if access is denied – but it has not done so. In fact, so far the only time I have seen Safari prompt for consent in Google+ is when making a post:

image

If you agree, this allows Google+ to geotag your post.

I am sure there are other ways Google plans to use your location in Google+. For the moment though, if you would rather maintain location privacy Google+ still allows you do to do so.

Hands On with Flash Builder 4.5.1 for Apple iOS

Flash 4.5.1 has been released recently, the first with integrated support for Apple iOS as well as Google Android and RIM Blackberry Tablet OS. I was keen to try my calculator app on iOS, having already tested it for Android. You can do most of the development on Windows, but I moved the project to OS X so I could try it in the iOS simulator and then on an actual iPhone 4.

Adding iOS as a target platform was easy: right-click the project, choose Properties, check to add the platform.

image

Then I worked on the UI. The buttons on my design were too small. The answer I guess is to use relative sizes, but I thought for a quick test I would simply set the device to Apple iPhone 4 and resize the layout for that.

image

After a bit of tweaking I got the app working nicely in the iOS simulator, again set to iPhone4. I was also able to set breakpoints and debug the app easily.

image

Then I tried it on the device. I did the Apple provisioning dance. I then compiled a release build, which took a long time and featured a thermometer that stuck on zero the entire time. It worked though, and I got the app into iTunes and synched.

On the device the app did not look too good.

image

Well, I have read up on supporting multiple screen sizes and on setting mobile project preferences and I am still not sure why this did not work, especially as it looked OK in the simulator. I had auto-scaling on, and the docs say:

When you enable automatic scaling, Flex optimizes the way it displays the application for the screen density of each device.

I fixed the the immediate issue though by adding the attribute applicationDPI=”320” to the ViewNavigatorApplication element.

Now it works fine.

image

So how is performance? I have managed to create some rather poorly performing calculator UIs in my various tests of cross-platform mobile tools, and this is one of the better ones, though not as responsive as the Titanium app on iOS. However the Flex app is more consistent across Android and iOS, whereas Titanium was poor on Android. Loading takes a few second, but it is acceptable. The app size is only 6MB which is not bad, considering that the necessary bits of Adobe AIR are compiled into it.

Note that this is little more than a Hello World app. My reasoning is that if this does not work well, then nothing will.

So far I am encouraged. Taking into account the development experience and performance across both Android and iOS, this is one of the best I have tried so far with my simple example.