This document is a step by step explanation of how to create a simple native iOS application with GeneXus.

In this sample, the application connects to REST services in Ruby that persists data on SQLServer. If you are using another generator (.NET or Java) or DBMS the steps are the same but the prerequisites change.

Before starting with the tutorial please check that the prerequisites are correctly installed. See this for more information.

Step 1

Open GeneXus and create a New Knowledge Base. Select Ruby as the Prototyping Environment. 

SD Creating KB

Step 2

Create a Customer and Company Transaction with the following structure:

Android GX Step 2 

Please note that predefined domains were used for certain attributes and, in both cases, be sure to set as True the Autonumber property of each identifier attribute (i.e.: positioned on the CustomerId field, press F4 to see its properties, and change the Autonumber property. Do the same for the CountryId attribute).

Step 3

Apply Work With for Smart Devices pattern to both transactions (e.g.: open each transaction, click on Patterns selector, choose Work With for Smart Devices tab, and check the check box as shown below. Then, save):

SD Applying WW to Customer

From the Toolbox, drag & drop the control Attribute/variable in order to insert attributes you want to see on the Customer list screen (e.g.: CustomerEmail):

SD draging attributes to layout

To remove the attribute label, change the Label position property, to "None" value:

SD No label caption for an attribute

Step 4

Create a Menu object called Menu. 

Creating a Dashboard from New Object Window

This object is like a menu; you can use it to call the Work With objects created in the previous Steps. To do it: right click in the Items option to add actions to the Dashboard. You must select the WorkWithDevices<TransactionName> objects in the Select Object dialog:

SD Getting Started Dashboard

When you select a WorkWithDevices<TransactionName> object, the Event associated to this action will be generated automatically:

Event 'WorkWithDevicesCustomer'
     WorkWithDevicesCustomer.Customer.List()
EndEvent

Event 'WorkWithDevicesCompany'
     WorkWithDevicesCompany.Company.List()
EndEvent

Step 5

Edit the SmartDevices Generator Preferences. Set the following properties:

Generate Android property False
Generate BlackBerry property False
Generate Apple property True
Main Platform property iOS
Execution Type property

Knowledge Base Navigator (Device)

My first iOS application Preferences

Now, download and install into your iOS device, the GeneXus KBN, that is, a kind of browser that let's you execute your GeneXus application. Execute it and Login with your GXtechnical Username/Password, as stated in iOS Applications Wireless Prototyping.

iOS KBN Login

Doing that, your device will be registered in your profile at gxtechnical.com.  

Execution Device property You have to choose in which of your registered devices the prototyping is going to be done. If you have not logged in yet, you will be asked to do it; after that the following window opens, so you can choose the device:
 

SnapShot Properties Execution Device

 

Step 6

Press F5 to build the application. At the first time you do this GeneXus needs to know the data base connection information. This may help too: First Ruby Model.

SD GettingStarted Set Build Proccess

If your computer and the Device are not in the same network (viewing each other), and/or you prefer a simpler solution for wireless prototyping, you could  deploy to cloud (we recommend that option for your first devolop). For that, press Cancel on the window, and go to Preferences, setting Yes for the "Deploy to cloud" property, as shown below:

Deploy To cloud Ruby Environment

The following output is shown, as well as the Impact Anlaysis report, indicating the tables that must be created on databae. Click on Create button in order to actually create them.

SD Impact Analysis Report

and then GeneXus shows the following output, as well as runs your default web browser:

SD iOS run output

After executing the web application on your computer, a Notification will appear on your device (in this case iPad), that will automatically take you to the KBN. On this screen you can see the URL (or you can introduce a URL shortcut(*1)) where it is deployed and underneath you have to select which application you want to execute. Then, enter to your application.

iOS First wireless prototyping execution

Enjoy!

Some Pics

SD Getting Started iOS Some Pictures

Note: To display an image to each menu action, go to the corresponding dashboard object created in step 4 and positioned on each action, associate the image (inserting simultaneously in KB) through the properties dialog:

Image Dashboard Action Property

Footnotes

(*1)  Available since GeneXus Evolution 3 Upgrade 7

Download the XPZ

My First Apple Model

For more information check Apple - FAQ and Common Issues

See also

My first Android application
My first BlackBerry application