iPhone | Andreano Lanusse | Technology and Software Development http://www.andreanolanusse.com/en/development/iphone-technology/ Where Andreano Lanusse talk about technology, software development, programming techniques, databases, games and more through articles, tutorials and videos Wed, 31 Jan 2018 04:25:38 +0000 en hourly 1 https://wordpress.org/?v=6.3.4 What’s new in Delphi XE4? http://www.andreanolanusse.com/en/whats-new-in-delphi-xe4/ http://www.andreanolanusse.com/en/whats-new-in-delphi-xe4/#comments Mon, 22 Apr 2013 14:16:40 +0000 http://www.andreanolanusse.com/en/?p=918 This time you didn’t have to way a full year to see a new Delphi release, 8 months after XE3 release Delphi XE4 is out. iOS development is the major topic of course and bring the second version of FireMonkey to iOS, a lot of expectation on this topic specially after XE2. Also there is […]

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
This time you didn’t have to way a full year to see a new Delphi release, 8 months after XE3 release Delphi XE4 is out.

iOS development is the major topic of course and bring the second version of FireMonkey to iOS, a lot of expectation on this topic specially after XE2.

Also there is a bunch of new stuffs to talk about, like:

  • New Delphi compiler for mobile platform, which brings several changes in the language and set a future path to the Delphi language, obvious these changes will affect desktop development in the future and you need to start learning about that now.
  • The SQLite and InterBase support for iOS
  • ClientDataSet available on iOS
  • Several FireMonkey changes for iOS, componentes, new classes
  • Etc..

RAD Studio XE4 now includes only Delphi, C++Builder and HTML5Builder. Delphi Prism is no longer part of RAD Studio, the name is dead and from now you have to refer to Oxygene from RemObjects. You can check the official communication from RemObjects here, where Marc Hoffman provide more details about the future related to .NET development with Oxygene (old Prism) and their support to iOS and Android development.

Trial is already available here or if you prefer download the full Delphi and C++Builder ISO here.

The Delphi XE4 documentation has a extensive list of What’s new in Delphi and C++Builder XE4, below the table of content:

That’s it for now.

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
http://www.andreanolanusse.com/en/whats-new-in-delphi-xe4/feed/ 9
Using iOS MapKit and CoreLocation with Delphi Prism and MonoTouch http://www.andreanolanusse.com/en/using-ios-mapkit-and-corelocation-with-delphi-prism-and-monotouch/ http://www.andreanolanusse.com/en/using-ios-mapkit-and-corelocation-with-delphi-prism-and-monotouch/#comments Mon, 27 Dec 2010 22:40:05 +0000 http://www.andreanolanusse.com/en/?p=418 The iPhone Maps application is one of the most useful app for me, we always used this app to track a direction, check the traffic, search for a restaurant, gas station, etc. In this post I will show how to use the MapKit and CoreLocation framework from iOS SDK, both enable mapping related functionality within […]

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
The iPhone Maps application is one of the most useful app for me, we always used this app to track a direction, check the traffic, search for a restaurant, gas station, etc. In this post I will show how to use the MapKit and CoreLocation framework from iOS SDK, both enable mapping related functionality within you application.

The MapKit provide a visual presentation of geographic information using Google Maps data and image, using the MKMapView control, the same use in the iPhone Maps app. The MapKit framework is exposed on MonoTouch via the MonoTouch.MapKit namespace.

CoreLocation works on a number of iOS devices using a variety of technologies to determine position, and using a built-in compass of newer devices provides the heading the device is pointing to. Using this information you can determine where users are and what direction their device is facing, and by monitoring changes to that data how fast they are moving and how far they have traveled. The CoreLocation framework is exposed on MonoTouch via the MonoTouch.CoreLocation namespace, and deal with two types of information: Location and Heading.

I’m assuming you already watch my introductory presentation about iPhone which I explain how to create a simple Web browser using Mono IDE and Interface Builder, on this post I will just go through the implementation.

In order to use MKMapView you just need to drag and drop the control in your window using Interface Builder, also the Segmented Control which will allow you to change the Map type (Standard, Hybrid, Satellite).

Based on the address informed I will add a PIN on the correspondent location, to do add PIN markers to the map requires creating and adding MKAnnotations to the MKMapView. MKAnnotation is a abstract class and need to be implemented in your application, like the code bellow.

	  MyAnnotation nested in AppDelegate = public class(MKAnnotation)
	  private
	    _coordinate: CLLocationCoordinate2D;
	    _title: System.String;
	    _subtitle: System.String;
	  public
	    property Coordinate : CLLocationCoordinate2D read _coordinate write _coordinate;override;
	    property Title: System.String read _title; override;
	    property Subtitle: System.String read _subtitle; override;
     	    // The custom constructor is required to pass the values to this class,
	    // because in the MKAnnotation base the properties are read-only
	    constructor (l: CLLocationCoordinate2D; t: System.String; s: System.String);

	  end;

Now I had to implement the Search Bar delegate to handle events that it generates, it’s not a full implementation of the UISearchDelegate but it implement what is necessary to implement the search behavior.

The Search button will retrieve the latitude/longitude from Google’s web service and add a pin to the map using the MyAnnotation class. Remember you need to sign up a Google Maps key at http://code.google.com/apis/maps/signup.html to use this application, assigned the Google Maps Key to the variable GoogleMapsKey.

	  MySearchBarDelegate nested in AppDelegate = public class(UISearchBarDelegate)
	  private
	    app: AppDelegate;
	    lastResult: MyAnnotation;
	    GoogleMapsKey:String := String.Empty; // Define you google maps key here.
            // Keep a reference to the application so we can access the UIControls.
	   // This needs to be an internal class to access those (private) controls.
	  public
	    constructor (a: AppDelegate);
		// Method for the searchbar to call when the user wants to search,
		// where we create and call the Geocoder class. Note that we are
		// calling it synchronously which is undesirable in a "real"
		// application.
	    method SearchButtonClicked(searchBar: UISearchBar); override;
	  end;

method AppDelegate.MySearchBarDelegate.SearchButtonClicked(searchBar: UISearchBar);
begin

  var g := new Geocoder(GoogleMapsKey);
  var location: CLLocationCoordinate2D;
  searchBar.ResignFirstResponder;
  UIApplication.SharedApplication.NetworkActivityIndicatorVisible := true;

  // synchronous webservice call
  if g.Locate(searchBar.Text, out location) then begin
    if lastResult <> nil then
    begin
      // if there is already a pin on the map, remove it
      app.Map.RemoveAnnotation(lastResult)
    end;

    app.Map.SetCenterCoordinate(location, true);
    var pin := new MyAnnotation(location, searchBar.Text, location.Latitude.ToString + ',' + location.Longitude.ToString);
    app.Map.AddAnnotationObject(pin);
    lastResult := pin;
  end
  else
  begin
    // display a message that the webservice call didn't work
    using alert := new UIAlertView('Not found', 'No match found for ' + searchBar.Text, nil, 'OK', nil) do
    begin
      alert.Show()
    end
  end;
  UIApplication.SharedApplication.NetworkActivityIndicatorVisible := false;
end;

To finalized here the implementation of the Geo code using Google web services, just passing the address and Google will retrieve the latitude/longitude.

interface

uses
  System,
  System.Xml,
  System.IO,
  System.Net,
  MonoTouch.CoreLocation;

// Documentation for the service http://code.google.com/apis/maps/documentation/geocoding/
type
  Geocoder = public class
  public
    constructor (key: System.String);
    // Sign up for a Google Maps key http://code.google.com/apis/maps/signup.html
  private
    var _GoogleMapsKey: System.String;
    var xmlString: System.String := '';
  public
    method Locate(query: System.String; out return: CLLocationCoordinate2D): System.Boolean;
  private
    // Retrieve a Url via WebClient
    class method GetUrl(url: System.String): System.String;
  end;

implementation

constructor Geocoder(key: System.String);
begin
  _GoogleMapsKey := key;
end;

method Geocoder.Locate(query: System.String; out return: CLLocationCoordinate2D): System.Boolean;
var
  url: System.String := 'http://maps.google.com/maps/geo?q={0}&output=xml&key=' + _GoogleMapsKey;
  coords: XmlNode := nil;
  xd: XmlDocument;
  xnm: XmlNamespaceManager;
  gl: System.String;
  coordinateArray: array of System.String;
begin

  url := String.Format(url, query);
  return := new CLLocationCoordinate2D(0, 0);

  try
    xmlString := GetUrl(url);
    xd := new XmlDocument();
    xd.LoadXml(xmlString);
    xnm := new XmlNamespaceManager(xd.NameTable);
    coords := xd.GetElementsByTagName('coordinates')[0]
  except 

  end;

  if coords <> nil then begin
     coordinateArray := coords.InnerText.Split(',');

     if coordinateArray.Length >= 2 then begin
        gl := Convert.ToDouble(coordinateArray[1].ToString()).ToString + ',' + Convert.ToDouble(coordinateArray[0].ToString());

      return := new CLLocationCoordinate2D(Convert.ToDouble(coordinateArray[1].ToString()),
                                            Convert.ToDouble(coordinateArray[0].ToString()));
      exit true
     end
  end;

  exit false
end;

class method Geocoder.GetUrl(url: System.String): System.String;
var
  return: System.String := System.String.Empty;
  client: System.Net.WebClient := new WebClient();
begin

  using strm: Stream := client.OpenRead(url) do
  begin
    var sr: StreamReader := new StreamReader(strm);
    return := sr.ReadToEnd()
  end;

  exit return;
end;

end.

When we run the application we can have three different views of the Map, the pin (in red) is the location of our office here in Scotts Valley.

The source code is available at CodeCentral.

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
http://www.andreanolanusse.com/en/using-ios-mapkit-and-corelocation-with-delphi-prism-and-monotouch/feed/ 7
Video: Building .NET based applications for Linux and iPhone with Mono and Monotouch http://www.andreanolanusse.com/en/video-building-net-based-applications-for-linux-and-iphone-with-mono-and-monotouch/ http://www.andreanolanusse.com/en/video-building-net-based-applications-for-linux-and-iphone-with-mono-and-monotouch/#comments Mon, 29 Nov 2010 19:25:25 +0000 http://www.andreanolanusse.com/en/?p=406 If you didn’t have a chance to watch my CodeRage 5 session “Building Managed Code Cross Platform Applications with Delphi Prism” the reply is available. During this presentation I introduce Mono and Monotouch frameworks and how you can use Delphi Prism integrated to Visual Studio 2010 to create .NET Web Services and ASP.NET applications and deploy […]

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
If you didn’t have a chance to watch my CodeRage 5 session Building Managed Code Cross Platform Applications with Delphi Prism” the reply is available. During this presentation I introduce Mono and Monotouch frameworks and how you can use Delphi Prism integrated to Visual Studio 2010 to create .NET Web Services and ASP.NET applications and deploy on Linux, as well the Mono IDE integrated with Delphi Prism on Mac to create iPhone/iPad applications.


The Web browser source code sample is available here

Watch more CodeRage replay videos

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
http://www.andreanolanusse.com/en/video-building-net-based-applications-for-linux-and-iphone-with-mono-and-monotouch/feed/ 7
New iPhone/iPad Project and File Templates for Delphi Prism http://www.andreanolanusse.com/en/new-iphoneipad-project-and-file-templates-for-delphi-prism/ http://www.andreanolanusse.com/en/new-iphoneipad-project-and-file-templates-for-delphi-prism/#comments Thu, 04 Nov 2010 18:55:52 +0000 http://www.andreanolanusse.com/en/?p=393 Yesterday our partner RemObjects released a add-in for Delphi Prism, this add-in brings a new project templates for iPhone and iPad development with Mono IDE, as well it’s include new MonoMac template. This add-in only applies for Mono IDE since it is related with MonoTouch and MonoMac. Here some of the new project templates available: […]

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
Yesterday our partner RemObjects released a add-in for Delphi Prism, this add-in brings a new project templates for iPhone and iPad development with Mono IDE, as well it’s include new MonoMac template. This add-in only applies for Mono IDE since it is related with MonoTouch and MonoMac.

Here some of the new project templates available:

  • iPhone Navigation-based Project
  • iPhone OpenGL Project
  • iPhone Utility Project
  • iPad Window-based Project

Also, after your project create you will see some new templates using the option File –> New File

  • iPad View
  • iPad View with Controller
  • iPhone View
  • iPhone View Controller

Update instructions:

  • Select the Tools|Add-In Manager menu item in the MonoDevelop IDE.
  • In the dialog that opens, click the Repositories button, then select Add and add the URL https://secure.remobjects.com/api/monodevelop/mac/.. (You only need to do this once, and this will give you access to all future add-ons).
  • Once the repository is registered, click the Install Add-Ins… button – you will find the new templates under the Templates section.

That is it.

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
http://www.andreanolanusse.com/en/new-iphoneipad-project-and-file-templates-for-delphi-prism/feed/ 2
Don’t worry you can write Delphi Prism applications for iPhone/iPad http://www.andreanolanusse.com/en/dont-worry-you-can-write-delphi-prism-applications-for-iphoneipad/ http://www.andreanolanusse.com/en/dont-worry-you-can-write-delphi-prism-applications-for-iphoneipad/#comments Thu, 09 Sep 2010 22:30:02 +0000 http://www.andreanolanusse.com/en/?p=352 Many of you didn’t want to take the risk to write iOS applications based on monotouch because of the Apple iOS 4 license agreement, now it changes, today Apple announced to “relax all restrictions on the development tools used to create iOS apps, as long as the resulting apps do not download any code”. In […]

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
Many of you didn’t want to take the risk to write iOS applications based on monotouch because of the Apple iOS 4 license agreement, now it changes, today Apple announced to “relax all restrictions on the development tools used to create iOS apps, as long as the resulting apps do not download any code”.

In other words start development your iOS applications and make some money.

Apple you provide a new reviewer guidelines, explaining what is allowed and what is not before you start build applications.

That’s a great news, days ago I published an article about iPhone development take a look.

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
http://www.andreanolanusse.com/en/dont-worry-you-can-write-delphi-prism-applications-for-iphoneipad/feed/ 9
Building iPhone Apps with Delphi Prism XE http://www.andreanolanusse.com/en/building-iphone-apps-with-delphi-prism-xe/ http://www.andreanolanusse.com/en/building-iphone-apps-with-delphi-prism-xe/#comments Fri, 13 Aug 2010 10:00:15 +0000 http://www.andreanolanusse.com/en/?p=328 One of cool features in Delphi Prism XE is the support for iPhone Development using MonoDevelop IDE and MonoTouch, since you already know Delphi language it helps you to jump on iPhone world, another cool feature is the ability to build Moonlight applications (the Mono alternative to Silverlight). For iPhone Development we use two IDEs: […]

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
One of cool features in Delphi Prism XE is the support for iPhone Development using MonoDevelop IDE and MonoTouch, since you already know Delphi language it helps you to jump on iPhone world, another cool feature is the ability to build Moonlight applications (the Mono alternative to Silverlight).

For iPhone Development we use two IDEs:

  • MonoDevelop IDE integrated with Delphi Prism to create and manage our projects.
  • Interface Builder allows developers to create interfaces for applications using a graphical user interface.

Both IDE’s are very easy to use and reusing our knowledge in Delphi language plus the new features of Delphi Prism language helps a lot. For every new platform is important to understand how it works, with iPhone is not different and I high recommend you to understand first the MVC concept and the iPhone Platform.

Today I was working on some samples and I took two screenshots showing the MonoDevelop IDE and Interface Builder, the second one shows my simple web browser built in Delphi Prism XE.

Delphi Prism XE building iPhone App

MonoDevelop IDE integrated with Delphi Prism XE

Interface Builder in front and behind MonoDevelop IDE integrated with Delphi Prism XE

Next week, here in San Jose, CA we have the DelphiLive, our Delphi Conference where you will have the opportunity to meet and talk face to face with other Delphi developers, as well you will meet the Delphi team and improve your skills. My session “Building managed-code cross platform applications with Delphi Prism” on DelphiLive will demonstrate how you can start developing iPhone applications and how to develop web applications using ASP.NET and deploy on Linux.

I forgot to add an important information about the requirements to build iPhone apps with Delphi Prism, in order to deploy apps to the Apple iPhone AppStore users will need to obtain a MonoTouch deployment license from Novell, join the Apple Developer program, and must adhere to Apple’s iPhone developer license terms. While Apple so far is passing MonoTouch applications, including games built with the Unity Framework, we cannot guarantee that Apple will pass MonoTouch developed applications in the AppStore.

Today Apple announced to “relax all restrictions on the development tools used to create iOS apps, as long as the resulting apps do not download any code”.

For sure there are lot of question about this topic. I will blog more about iPhone Development with Delphi Prism in the future.

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
http://www.andreanolanusse.com/en/building-iphone-apps-with-delphi-prism-xe/feed/ 18
Apple battle iAd vs Google AdSense and HTML5 vs Flash http://www.andreanolanusse.com/en/apple-battle-iad-vs-google-adsense-and-html5-vs-flash/ http://www.andreanolanusse.com/en/apple-battle-iad-vs-google-adsense-and-html5-vs-flash/#respond Mon, 12 Apr 2010 08:58:55 +0000 http://www.andreanolanusse.com/en/?p=297 Last week was a busy week for Apple, starting with the new iPhone agreement to develop applications using the SDK 4. I don’t want to make comments about that at this point. I believe anything can happen before they release the iPhone SDK 4, moving forward Steve Jobs presented the first preview of the iPhone […]

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
Last week was a busy week for Apple, starting with the new iPhone agreement to develop applications using the SDK 4. I don’t want to make comments about that at this point. I believe anything can happen before they release the iPhone SDK 4, moving forward Steve Jobs presented the first preview of the iPhone OS 4, which finally will support Multitasking :), but the main point during his presentation was the iAd announcement which in my opinion impact Adobe and Google.

Months ago Apple acquired Quattro Wireless, a major player in mobile ad space, during this event Steve Jobs announced an advertising service called iAd, which offers more them simple advertisement service. When you touch an ads in iPhone today you are redirected to a browser closing your application, the new iAd is integrated in the platform and will change the user experience allowing to see ads without quit of the application. Apple will provide the whole ads infrastructure and will share the revenue with the developers.

Steve Jobs used an News app to demo the iAd integration, the app included a Toy Store iAd banner. coincidence or not the ads use HTML 5 and not Flash. Steve wasn’t subtly and mention HTML 5 at least three times, you can see the audience laughing out loud.

It seems iAd and HTML 5 are part of apple strategy to kill Flash, at the same time will help Apple to increase revenue, will be interesting to see Google strategy to convince developer to use AdSense instead iAd.

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
http://www.andreanolanusse.com/en/apple-battle-iad-vs-google-adsense-and-html5-vs-flash/feed/ 0
iPad the new Apple Tablet AKA (Big IPHONE) :) http://www.andreanolanusse.com/en/ipad-the-new-apple-tablet-aka-big-iphone/ http://www.andreanolanusse.com/en/ipad-the-new-apple-tablet-aka-big-iphone/#respond Wed, 27 Jan 2010 19:09:51 +0000 http://www.andreanolanusse.com/en/?p=226 Apple Wednesday announced a touchscreen tablet computer, the “iPad” for consumers who want to take their movies, TV shows, music, games and reading with them, be it around the house or on the go. If you’re a current iPhone user, much of the interaction with the iPad looks to be very familiar. For instance, tilting […]

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>

Apple Wednesday announced a touchscreen tablet computer, the “iPad” for consumers who want to take their movies, TV shows, music, games and reading with them, be it around the house or on the go.

If you’re a current iPhone user, much of the interaction with the iPad looks to be very familiar. For instance, tilting the iPad gives you portrait or landscape viewing — both orientations support a lovely full screen keyboard. It also appears that the app icons on the “home screen” change orientation too.

Apple iPad specs:

  • 9.7-inch display with 0.5-inches thickness.
  • 16GB to 64GB of on-board flash memory
  • 10 hrs of battery life. Over a month for standby
  • 1GHz Apple A4 chip (developed for the iPad)
  • WiFi 802.11n
  • Bluetooth 2.1
  • accelerometer
  • digital compass
  • speaker and a microphone
  • 30-pin dock connector

Looking forward to see the new iPad, particular when I was looking to buy a Amazon Kindle, but now I think Amazon will accelerate the Kindle 3.

More information in http://www.apple.com/ipad/

Andreano Lanusse | Technology and Software Development Follow me on Twitter: @andreanolanusse

]]>
http://www.andreanolanusse.com/en/ipad-the-new-apple-tablet-aka-big-iphone/feed/ 0