FileMaker iOS SDK - Part 4

By James Currie, 12 May 2016

Building an iOS App from a FileMaker Database

Welcome to the fourth and final part of the FileMaker iOS App SDK series. In the final part of the series I will take you through building and compiling the iOS App. If you haven't yet read through parts 1, 2 and 3; now would be a good time to go take a look.

Building the iOS App

We will start by opening the WindowFurnishing.xcodeproj file that we created in part 3. In the Xcode project window we’ll click the disclosure triangle next to Custom Application Resources and again next to Solution Files. The Solution Files directory is where the iOS App expects the FileMaker files to be.

xcode project

It’s important to note that each iOS app has its own documents directory in addition to the Solution Files directory. When the WindowFurnishing app is launched for the first time on iOS, the files from the Solution Files directory are copied to the WindowFurnishing app documents directory, from there the user adds / updates the data in the app documents directory files. When an iOS device is plugged into a computer with iTunes installed you can access the App documents directory by selecting the iOS device >> Apps and the app name in the File Sharing section.

We will remove the PlaceHolder.fmp12 file by selecting it and pressing delete. We can copy our files into the Solution Files directory by dragging and dropping on the folder in the Xcode window.

xcode project mcw

With our files in place we need to tell the iOS App what file to open at launch. In the Custom Application Resources folder Click on the configFile.txt file and change the following line

launchSolution = PlaceHolder.fmp12

to

launchSolution = WindowFurnishing.fmp12

If we try and specify a file name in launchSolution that doesn’t exist the iOS App will fail to build. The launchSolution file name is also case sensitive, if we don’t get the casing correct the build will succeed but the iOS App will not launch the FileMaker solution.

There are two further options in the config file that can be changed:

helpURL - this is the URL to your apps support or help site, if this is left blank the help menu is removed from the app. If your custom files are being opened in Kiosk mode the help menu will not be available.

alwaysOverwrite - this specifies whether the Solution Files are copied fresh into the apps document directory when the app launches. If this is set to 1 everytime we launch the WindowFurnishing app the Solution Files will be copied into the documents directory. This means that the files will “reset” at each launch. Setting this value to 1 is only recommended for testing purposes.

We'll save our changes to the config file and continue on.

Creating and Adding images

We’ll now create and add some icons for our iOS App, icons and images need to follow the Apple guidelines for icons and image sizes.

Adding icons to our App is very straight forward through the drag and drop interface provided in Xcode, to access this interface click on the CustomAppAssets.xcassets folder. We can see there are three icons sets available for changing: AppIcon, LaunchImage and ObscureIcon.

AppIcon - The app icon is the icon that we see on the iOS home screen. iOS devices will have different icon size requirements depending on model.

LaunchImage - The launch image is used as a splash screen while the iOS app launches

ObscureIcon - If our FileMaker app uses the fmreauthenticate extended privilege the iOS App will display a security shield over the content when the iOS App is moved into the background.

Let's start by clicking on AppIcon and dragging our icons in for each of the devices and sizes required. Xcode will show a warning triangle in the title bar if we have used any incorrectly sized icons. Clicking on the warning triangle will present a dropdown showing the list of warnings. We will be able to build and test our iOS App with these warnings but there is no guarantee the icons will look as expected on all devices and versions of iOS.

xcode images

Changing the Settings of our iOS App

Before we can build and test our iOS App we need to change some settings. Our iOS App requires Data Protection to be enabled, a version number and a build number.

We’ll start by enabling Data Protection. Click on the WindowFurnishing project and then click on capabilities in the main project window. We can see that Background Modes has already been turned on for us, we’ll find Data Protection in the list and click the toggle to turn it on.

xcode general dataprotection

Next we need to specify the version and build numbers for our iOS App, we’ll click on the General tab in the main project window to bring up these settings. In the Identity section add the version number and build number.

Optionally we can specify a URL scheme for our iOS App. FileMaker Go uses fmp for its url scheme, we will have to use a unique URL scheme. We'll start by selecting the Info tab in the main project window, click on URL Types to open the drop down. We will create a URL scheme by clicking the plus button and entering mcw into the URL Schemes box, other apps and websites will be able to use mcw:// to interact with our app.

xcode info urltypes

Other optional settings

Under the General tab in the main project window we can see there are a few other options that can be set, a few of these options can be safely changed. In the Deployment Info section we can make changes to the following options to suit our needs:

Devices - We can choose the iOS devices our app runs on (iPhone, iPad or Universal).

Device Orientation - We can choose to restrict which orientations are allowed for our iOS App, note that on devices that support full screen this setting will be ignored.

Status Bar Style - We can choose to have the default style or use the light style status bar (this is the bar where the cell info, clock etc is located)

Hide Status Bar - We can choose to hide the status bar in our app completely

Requires Full Screen - If this option is checked our iOS App will not be able to be used in Slide Over or Split View.

On the info tab in the Custom iOS Target Properties section we can also change the “Application supports iTunes file Sharing” option. This is set to Yes by default, if we change the value to No users will be prevented from accessing the app documents directory through iTunes.

xcode custom properties

Compiling and testing the iOS App

We are now ready to compile and test our iOS App. First we need to ensure that our device is plugged into our computer and unlocked. We will specify which device we will be testing on by selecting it in the Xcode window. Click on the device menu to bring up the dropdown. The devices menu lists the devices plugged into the machine as well as any iOS simulators that are installed (the latest devices are installed along with Xcode). We can use the simulators to test our app on device that we may not have physical access to.

xcode devices

With our device selected we can go ahead and push the play icon in the title bar. A progress indicator will be displayed in the centre of the Xcode title bar indicating the Apps build progress. Once Xcode has finished building the iOS App it will be installed and launched automatically on our iPad.

Xcode immediately puts our iOS App into debugging mode, we can stop Xcode from debugging our App by clicking on the debug menu and selecting the detach option at the bottom of the list. If we wish to re-enter debugging mode we can simply click on the debug menu and in the “Attach to Process” submenu select WindowFurnishing, it can take a few seconds for the process list to load.

Congratulations, we have successfully compiled and built an iOS App from our custom FileMaker solution.

Something to say? Post a comment...

Comments

  • James Currie 28/03/2018 8:11am (1 year ago)

    Hi Thiyagarajan,

    There is no way to point the solution file to a hosted FileMaker app. A simple work around is to create a new file (which we will refer to as the opener file). This file is setup quite simply with an OnFirstWindowOpen script trigger which runs an open file step to open your hosted file.

    There is a chance that the hosted file may get disconnected while the SDK app is in the background on iOS (or the user could close the hosted file). I suggest including a way for the user to re-open the hosted file if this happens. Adding a button on the layout which runs the same script as the OnFirstWindowOpen trigger would be one way to achieve this.

  • Thiyagarajan 27/03/2018 11:30pm (1 year ago)

    In this example , we have used a stand alone filemaker application. I have a hosted filemaker application. how i can call hosted filemaker db under "Solution files" in xcode project?

RSS feed for comments on this page | RSS feed for all comments