Sunday Jan 24, 2016

A quick checklist for setting up your iOS application for Oracle Mobile Cloud Service

On a nearly daily basis I create iOS demo applications in Xcode with Oracle Mobile Cloud Service (MCS). When I started out building iOS apps for MCS our documentation was invaluable for how to install the MCS native SDK for iOS, and we even published a video to help beginners. But on a day by day basis given I've done this so many times I just want a simple checklist to remind me of the steps. And I'm pretty sure this will be useful for you to.

So without further explanation, as follows is a condensed set of steps you can use as a checklist for installing the MCS native SDK into a brand new iOS Xcode project:

  1. Download MCS iOS SDK from MCS, unzip and rename base directory 'MCS'.
  2. In Xcode create a new project (e.g. MyApp), Single View Application.
  3. From the OSX Finder drag 'n drop the MCS directory as the first node under the Xcode MyApp project. In the copy dialog ensure 'Copy items if needed’ and 'Create groups' are selected.
  4. With the MyApp project selected in Xcode and its 'General' page showing, navigate to the 'Linked Frameworks and Libraries' section and add three libraries: SystemConfiguration.framework, Security.framework, CoreLocation.framework.
  5. Select the MyApp project’s 'Build Settings' and search for 'Other Linker Flags'. Set this to '-ObjC' (without quotes, observe the case).
  6. Still under 'Build Settings' search for 'Search Paths'. Set 'Always Search User Paths' = Yes and 'User Header Search Paths' = ’$(PROJECT_DIR)/MCS/release-iphoneos' (without quotes) and set to 'recursive'.
  7. For the previous step once you click off the User Header Fields the '$(PROJECT_DIR)/MCS/release-iphoneos' should resolve to something like /Users/chris/Desktop/MyApp/MCS/release-iphoneos. In the OSX Finder double check what path the MCS subdirectory was actually added to the MyApp project then amend the User Header Fields property appropriately. A failure to do this will result in a compiler error later where Xcode will complain it can’t find OMCCore/OMCServiceProxy.h.
  8. In Xcode move the MCS/Documentation/OMC.plist file to a node under the project so it is more visible.
  9. Open the OMC.plist file 'as XML Source Code' via the right client menu and substitute the required values from the MCS MobileBackend. An example file can be seen below.
  10. Run the project - this should complete successfully.

An example OMC.plist file follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

If you're working with Objective-C you're set to go. If you're working with Swift, you also need to include a bridging header file. The instructions for doing this were covered in a recent post.

Tuesday Jan 19, 2016

Oracle Mobile Application Accelerator (MAX)

You know, I was tempted to refer to the Mad Max, Fury Road (great movie btw) but figured that today, I'm going to color within the lines. :)  

Oracle MAX.  You probably want (or are being asked) more and more of your apps to be mobile - but there's a backlog and you're stuck somewhere in the queue. :(

Meanwhile, you're tethered to your desktop/laptop or having to deal with a less than optimal mobile experience as you navigate your website on a tiny mobile screen.  

What if, for the majority of the cases (80/20 rule) you could build some straight forward apps that look great, get the job done, quickly and easily, no coding required. Simple drag and drop. Use proven designs.  Tap into preconfigured data/app sources.  Drag, drop, connect, build, deploy and done.  What wizardry is this you say?   I'm glad you asked. 

Checkout the Oracle MAX webinar, hosted by Oracle's own Denis Tyrell, and see for yourself. 

Follow @OracleMobile

MAF MCS Utility Patch for MAF 2.2.1

MAF MCS Utility is a library and public sample that simplifies integration of Oracle Mobile Cloud Service (MCS) in Oracle MAF applications. The MAF MCS Utility library and its sample application are shipped as part of the Oracle MAF public samples, located in the file, along with all the other MAF samples.

Sometimes things happen as they do! Unfortunately, when shipping Oracle MAF 2.2.1, the MAF MCS Utility provided with the release was broken. The effect of the defect is that you are getting re-routed to the login screen, or if you got around this problem, Storage and UserInfo don't work properly in the sample application. Using the MAF MCS Utility JAR file in a custom application may fail for Storage uploads in the response sent back from MCS.  

A fixed for MAF MCS Utility (maf-mcs-utility 2.2.1) will be shipped within the next version of Oracle MAF. However, no need to wait. For Oracle MCS and Oracle MAF customers to get the patch to the MAF MCS Utility now, the Oracle Mobile team made the MAF MCS Utility version 2.2.1 available for download online.

Please use the link below to download both in one: the MAF MCS Utility library (a JAR file) and the MAF MCS Utility sample application, which is a generic MCS tester that can be configured to run against any public Oracle MCS instance. 

Download Link: maf-mcs-utility 2.2.1

Sunday Jan 17, 2016

A little taste of Swift with Oracle Mobile Cloud Service

Within the iOS development world arguably there is a trend to adopt Apple's Swift language over Objective-C for new application development. History has taught Oracle not to pick sides in such debates, being "client agnostic" is a common and frequent term thrown around internal to Oracle these days to ensure we embrace all development technologies.

Extending this discussion around Swift to Oracle Mobile Cloud Service (MCS), Oracle's contemporary MBaaS solution, a question we're getting asked frequently is does MCS support Swift? Currently MCS support an iOS Objective-C SDK, but what about Swift?

The thing about this question is it typically doesn't come from veteran iOS developers, but from people who are in the process of learning iOS programming for the first time, have read about the Swift trend and picked that as their iOS language to learn, but don't yet know enough about the interoperability between Objective-C code and Swift.

In promoting Swift but realizing there was a huge Objective-C code base out there for iOS apps, Apple included an interoperable set of features to allow Objective-C to call Swift code and vice versa. In order for Swift to make use of Objective-C libraries, you implement a "bridging header file" which lists the Objective-C libraries to import and then makes them available to Swift in its native syntax.

So returning to MCS, what exactly would you need to do to build an iOS application in Swift, using the Objective-C SDK provided by MCS?

First you create a Swift app in Xcode. Then you load the MCS iOS SDK into your Xcode project as shown in this video. Next you add the bridging header file following these steps:

  1. With the Xcode project selected, create a .h file MyAppName_Bridging_Header.h (ensuring the file is a child of the project node).
  2. In the header file import all the MCS iOS SDK header files from under the MCS/release-iphoneos/include subdirectories. An example bridging header file for MCS can be seen below.
  3. Return to the project 'Build Settings’ and search for 'Objective-C Bridging Header’. Set this to MyAppName_Bridging_Header.h.
  4. Run the project - this should complete successfully.

The example bridging header file:

#ifndef MyAppName_Bridging_Header_h
#define MyAppName_Bridging_Header_h

#import "OMCAppConfig.h"
#import "OMCAuthorization.h"
#import "OMCCore.h"
#import "OMCDiagnostics.h"
#import "OMCMobileBackend.h"
#import "OMCMobileBackendManager.h"
#import "OMCServiceProxy.h"
#import "OMCUser.h"

#import "OMCAnalytics.h"
#import "OMCAnalyticsApplicationDelegate.h"
#import "OMCAnalyticsDelegate.h"
#import "OMCMobileBackend+OMC_Analytics.h"

#import "OMCNotifications.h"
#import "OMCMobileBackend+OMC_Notifications.h"

#import "OMCStorage.h"
#import "OMCStorageCollection.h"
#import "OMCStorageConstants.h"
#import "OMCStorageObject.h"
#import "OMCMobileBackend+OMC_Storage.h"

#import "OMCFetchFileBuilder.h"
#import "OMCFetchObjectBuilder.h"
#import "OMCFetchObjectCollectionBuilder.h"
#import "OMCMobileEndpoint.h"
#import "OMCMobileFile.h"
#import "OMCMobileObject.h"
#import "OMCMobileObjectCollection.h"
#import "OMCMobileResource.h"
#import "OMCSyncGlobals.h"
#import "OMCSynchronization.h"
#import "OMCSyncPolicy.h"
#import "OMCSyncStoreState.h"
#import "OMCMobileBackend+OMC_Synchronization.h"


Once you're done this you've pretty much set to go to call the MCS SDK libraries in Swift. What can be a bit of challenge from there is mentally converting Objective-C code examples to Swift. Objective-C uses a C like notation with pointers and an abundance of square brackets, while Swift has a simpler syntax in my opinion to learn, but notably drops semicolons as line terminators which my typing brain just can't help adding after 20 years as a programmer!

To help you on your way, following is an Objective-C example for authenticating MCS mobile users via the iOS MCS SDK, then the equivalent in Swift using the same SDK but also with the bridging header file. Here's the Objective-C example:

#import "OMCAuthorization.h"
#import "OMCMobileBackend.h"
#import "OMCMobileBackendManager.h"

OMCMobileBackendManager *manager = [OMCMobileBackendManager sharedManager];
OMCMobileBackend *backend = manager.defaultMobileBackend;
OMCAuthorization *auth = [backend authorization];
NSError *err = [auth authenticate:@"username" password:@"password"];

The following is the equivalent in Swift using the iOS SDK:

// No imports necessary when bridging header file used

let manager: OMCMobileBackendManager = OMCMobileBackendManager.sharedManager()
let backend: OMCMobileBackend = manager.defaultMobileBackend
let auth: OMCAuthorization = backend.authorization
let err: NSError! = auth.authenticate("username", password: "password")

Hopefully this gives you a little taste of Swift with Oracle Mobile Cloud Service.

Wednesday Jan 06, 2016

MAF and iOS 9 multitasking

Apple introduced the concept of multitasking in iOS 9, meaning that you can open a second app on your iPad without closing the one that you are currently using.

Mobile apps built with MAF 2.2.1 support iOS 9 multitasking by default.

For your app to support multitasking, it must also support all possible device orientations. If your app does not support all possible device orientations, when you try to upload it to iTunes Connect, it will report an error message such as:

ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations: 'UIInterfaceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight'

To fix this, you either need to add support for all device orientations, or opt out of multitasking support. If you must opt out of multitasking, you need to add the UIRequiresFullScreen key to your app’s Info.plist file with the value true.

The most convenient way to add this key is to create a very simple plugin that has a manifest file (plugin.xml) such as the following, without any additional files:

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="" 
        id="maf-plugin-opt-out-multitasking" version="1.0.0">

  <description>Opt out of iOS multitasking on iOS 9</description>

  <platform name="ios">
    <config-file target="*-Info.plist" parent="UIRequiresFullScreen">


Having created this plugin.xml file, open the maf-application.xml file’s Plugin UI and register this additional plugin, as follows:

A similar approach can be used any time you need to add a key to your MAF app's Info.plist file.

Wednesday Dec 23, 2015

MAF 2.2.1 HTML launch screen for iOS

MAF 2.2.1 has changed the manner in which you define a “launch screen” or “splash screen” for apps deployed to iOS devices.  Static images are no longer supported, meaning that if you previously used custom splash screen images in your app, you will need to create your own custom HTML launch screen for iOS when using MAF 2.2.1.

This post explains the reasons for the change and describes how to create a custom HTML launch screen for iOS.

Android splash screen images remain the same in MAF 2.2.1. For information about how to create a 9-patch image that stretches across different device screen sizes, refer to this blog post.


When a user launches an app on iOS, the operating system displays a launch image while the app is loading.  The purpose is to give the user the impression that the app has launched immediately.

Prior to iOS 8, app developers were required to provide static launch images for every device screen size, resolution and orientation supported by the app.

This approach has been supported by all MAF versions up to and including MAF 2.2.0. In fact, MAF extends this approach and continues to display the appropriate launch image while the framework is being initialized within the app.

Since iOS 8, Apple has encouraged use of a new approach, which is to use a single storyboard to define the launch image.

iOS 9 has introduced the concept of multitasking, meaning that apps can now be launched into a window that does not fill the device’s entire screen. To support multitasking, an app must use a storyboard to define the launch image as fixed-sized images will not work.

MAF 2.2.1 accommodates iOS 9 multitasking by allowing app developers to specify a single HTML-based launch screen, which has the added benefits of removing the onerous task of creating and maintaining a number of static launch images and reducing the size of the app.

Creating a custom HTML launch screen

If your app previously used the default MAF splash screen images, then there’s nothing you need to do when you uptake MAF 2.2.1, as MAF 2.2.1 provides a default HTML launch screen that contains the Oracle logo and copyright similar to the previous default images.

If you previously used custom splash screen images in your app, then you will need to create a custom HTML launch screen for iOS, as follows:

  1. Open the Application page of the maf-application.xml file's Overview editor.
  2. Select the "Custom" option under the Launch Screen section.
  3. Enter the location of an existing HTML page relative to the ApplicationController/public_html directory of your MAF application, or create a new page.

Since the launch screen is based on HTML, CSS and JavaScript, you now have much greater control over what can be displayed.

To get ideas about how to scale images and text across different window sizes, you can refer to the default HTML launch screen included in MAF 2.2.1.

Understanding the default HTML launch screen

To view the default HTML launch screen:

  1. Deploy any MAF 2.2.1 application to an iOS simulator or package.
  2. Navigate to the deploy/<iOS deployment profile>/temporary_xcode_project/FARs/OracleStandardADFmfUiComponents/public_html directory.
  3. Open maf-launch-screen.html in a text editor.

Without analyzing every line of code, let’s take a look at some of the important parts of this file..


The JavaScript functions at the top of the file are used to show and hide a loading indicator and a busy message based on a MAF event. You can include the same logic in your HTML launch screen if you wish to display a loading indicator and/or busy message.

If you don’t want a loading indicator or busy message to be displayed, you can remove the JavaScript and remove the loadingWrap and loadingBox page sections described below.

Page sections

The page is divided into the following sections:

  • background
  • logo
  • copyright
  • loadingWrap and loadingBox

The background and logo sections work together to display a small scalable vector graphic (SVG) image on a solid background color, which is the recommended approach for both performance and logistical reasons.

The launch screen will only be displayed for a short amount of time, so there’s not much time for a high-definition image to be loaded and displayed. In addition, a background image will be stretched and/or cropped to fit various window sizes, which may result in an unnatural-looking image.

If you would prefer something fancier than a solid background color, CSS supports linear and radial gradients. Online sites such as w3schools describe the syntax and provide examples. You can even find online CSS gradient generators at sites such as ColorZilla.

A small SVG image can stretch in a natural fashion to any window size without loss of quality, with the background color filling in the rest of the window. In the default launch screen, the image is embedded in the CSS as a data URI, but you could also co-locate the image file with your HTML launch screen and reference its location in the CSS.

The copyright section contains plain text that is displayed at the bottom of the page. The CSS determines the font size based on the available width of the window in which the launch screen is displayed. You could emulate this approach to display any text you want on your launch screen.

The loadingWrap and loadingBox sections are used to display an animated GIF loading image and a busy message. The JavaScript at the top of the file controls the visibility of these sections and the displayed message.


With MAF 2.2.1 you no longer need to create and maintain a number of splash screen images for iOS and your app size will be decreased.

If you previously used custom splash screen images for iOS, you must now create an HTML launch screen and the default HTML launch screen within MAF 2.2.1 can be used as a guide, as described above.


This blog is is dedicated to announcements,tips and tricks and other items related to developing, integrating, securing, and managing mobile applications using Oracle's Mobile Platform. It is created and maintained by the Oracle Mobile product development team.

Archive of past entries

Even More Mobile Development Blogs

Oracle A-Team Site - Mobile Related Entries

Code samples from the Community

Fusion Middleware Blogs


« February 2016