Swift & MCS - Condensed Xcode Project Setup Instructions
A condensed set of setup instructions for loading the Oracle Mobile Cloud Service iOS SDK into a fresh Xcode 'Swift' project.
Steps:
Download MCS iOS SDK, unzip and rename base directory 'MCS'.
In Xcode create a new project (e.g. MyApp), Single View Application, based on the Swift language.
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.
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.
Select the MyApp project's 'Build Settings' and search for 'Other Linker Flags'. Set this to '-ObjC' (without quotes, observe the case).
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'.
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.
In Xcode move the MCS/Documentation/OMC.plist file to a node under the project.
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.
With the project selected, create a .h file MyApp_Bridging_Header.h (ensuring the file is a child of the project node.)
Import all the MCS iOS SDK header files from under the release-iphoneos/include subdirectories. An example file can be seen below.
Return to the project 'Build Settings' and search for 'Objective-C Bridging Header'. Set this to MyApp_Bridging_Header.h.
Run the project - this should complete successfully.
An example OMC.plist file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>mobileBackends</key> <dict> <key>MyAppMCSMobileBackend/1.0</key> <dict> <key>default</key><true></true> <key>baseURL</key><string>http://someserver.oracle.com:7201</string> <key>appKey</key><string>112ad395-9d59-4286-b1a1-a393b05aa3fc</string> <key>authorization</key> <dict> <key>authenticationType</key><string>OAuth</string> <key>OAuth</key> <dict> <key>tokenEndpoint</key><string>http://someserver.oracle.com:14100/oam/oauth2/tokens</string> <key>identityDomain</key><string>prime</string> <key>clientID</key><string>d133b76b-b22f-4b24-bbec-4cde8e5d7fa6</string> <key>clientSecret</key><string>aNNlXZaAbMaynbbLoTr8</string> </dict> <key>Basic</key> <dict> <key>mobileBackendID</key><string>f7f5ab7352-518f-4022-a2d4-2a11044986c0</string> <key>anonymousKey</key><string>ALJJTXVfREVBAVBUSUNPTl9NA0JJTEBfQU5PTaaAT1VTX0AQUElEOnArZWJxUmwuamEwbTda</string> </dict> </dict> </dict> </dict> <key>logLevel</key><string>debug</string> </dict> </plist>
An example bridging file:
// // MyApp_Bridging_Header.h // MyApp // // Created by Chris Muir on 22/10/2015. // Copyright (c) 2015 Chris Muir. All rights reserved. // #ifndef MyApp_Bridging_Header_h #define MyApp_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" #endif












