MicroStrategy ONE

Set Up a Custom Project in iOS

To create a new project that you configure to use the Mobile SDK frameworks, install the Mobile SDK and follow the steps below.

  1. Open a project in Xcode  
  2. Add the required Mobile SDK frameworks  

  3. Add the framework and library search paths

  4. Add the required iOS frameworks  
  5. Add the required Mobile SDK folder  

  6. Add the vector font file

  7. Add target-specific information  
  8. Make changes to the application delegate  

  9. Confirm that the project compiles successfully

A detailed explanation of how to perform each step is provided below.

  1. Open a project in Xcode

    You can use an existing Xcode project or create a new one. In Xcode, expand the project to display the folders and files within it.   

  2. Add the Mobile SDK frameworks required for the project  

    1. Click <application project name> to view the targets for the project.  

    2. Click the appropriate <target name> to view the properties for the target.  

    3. Click the Build Phases tab for the selected target.  

      1. Expand Link Binary with Libraries.  

      2. Click + under Link Binary with Libraries .  

      3. In the Choose frameworks and libraries to add dialog, click the Add Other... button.  

      4. In the Finder, select MicroStrategyMobileSDK.framework (located by default in the Library folder). Either double-click MicroStrategyMobileSDK.framework or click the Open button. The framework is added to the project.  

      5. Again, click + under Link Binary with Libraries .  

      6. In the Choose frameworks and libraries to add dialog, click the Add Other... button.  

      7. In the Finder, navigate to MstrDMG, then Library, then OpenSSL, then lib. Select both libcrypto.a and libssl.a and click the Open button. The libraries are added to the project.  

      8. If you want to add other Mobile SDK frameworks (located by default in the Library folder), repeat the steps ii-iv. For example, if you want to use the RSS Reader or the Data Cloud widget, select MSTRRssReader.framework or MSTRDataCloud.framework in the Linking Library.  

    4. Click the General tab for the selected target.

      1. Expand Embedded Binaries.
      2. Click + under Embedded Binaries.
      3. In the Choose frameworks and libraries to add dialog, select MicroStrategyMobileSDK.framework . Either double-click MicroStrategyMobileSDK.framework or click the Add button. The framework is added to the project.
    5. Repeat steps b - d for each <target name> that will be used for building the project.
  3. Add the search path of the framework and library for the project
    1. Click <application project name> to view the targets for the project.
    2. Click the appropriate <target name> to view the properties for the target.
    3. Click the Build Settings tab for the selected target. To ensure that classes can be loaded on-the-fly when reflection is used, do the following for each target:

      1. Search for the text "Search".
      2. Double-click the Framework Search Paths setting to launch the dialog for editing this setting.
      3. Click + and add path “$(SRCROOT)/../../Library”.

        If the path has been changed, make sure to add the correct path for the MicroStrategyMobile framework.

      4. Double-click the Library Search Paths setting to launch the dialog for editing this setting.
      5. Click + and add path “$(SRCROOT)/../../Library/openssl/lib”.

        If the path has been changed, make sure to add the correct path for the MicroStrategyMobile library.

  4. Add the iOS frameworks required for the project  

    1. Click <application project name> to view the targets for the project.  

    2. Click the appropriate <target name> to view the properties for the target.  

    3. Click the Build Phases tab for the selected target.  

      1. Expand he Link Binary with Libraries panel.  

      2. Click + in the Link Binary with Libraries panel.  

      3. In the dialog that opens, click the Add button.  

      4. In the Finder, select the following frameworks and click Add. The frameworks are added to the project.  

        • Accelerate.framework

        • AssetsLibrary.framework

        • AudioToolbox.framework

        • AVFoundation.framework

        • CFNetwork.framework

        • CoreData.framework

        • CoreGraphics.framework

        • CoreImage.framework

        • CoreLocation.framework

        • CoreMedia.framework

        • CoreMotion.framework

        • CoreText.framework

        • CoreVideo.framework

        • Foundation.framework

        • GLKit.framework

        • ImageIO.framework

        • LocalAuthentication.framework

        • MapKit.framework

        • MediaPlayer.framework

        • MessageUI.framework

        • MobileCoreServices.framework

        • NewsstandKit.framework

        • OpenGLES.framework

        • QuartzCore.framework

        • QuickLook.framework

        • Security.framework

        • SystemConfiguration.framework

        • UIKit.framework

        • WebKit.framework
        • libiconv.tbd

        • libz.1.2.5.tbd  

        Some of these frameworks may already exist in the Frameworks folder.

    4. Repeat steps b - c for each <target name> that will be used for building the project.  

  5. Add the required Mobile SDK Resources folder for the project  

    1. Right-click <application project name> and select New Group. Then, rename the new group as Resource.

    2. Right-click Resource and select Add Files to "<application project name>". This displays a dialog for setting properties.  
    3. Navigate to MicroStrategyMobile\Resources, and select FinalBundle.bundle, IconFont, ImageCache.bundle, and MicroStrategyMobileSDKResources.bundle

      Tap and hold Command to make multiple selections.

      1. Do not select the Destination: check box for Copy items into destination group's folder (if needed).
      2. Select the Added folders: check box for Create folder references.
      3. Select the appropriate target for your project in the Add To Targets panel and click Add. The dialog closes.
  6. Add the font file that is used to support the vector font used in MicroStrategyMobileSDK
    1. Click info.plist.

      Expand Fonts provided by application.

      If this item does not exist, you need to create it.

    2. Add a new item called IconFont/font/mobile_analytics_ios.ttf.
  7. Add target-specific information  

    1. Click <application project name> to view the targets for the project.  

    2. Click the <target name> to view the properties for the target.  

    3. Click the Build Settings tab for the selected target.

      To ensure that classes can be loaded on-the-fly when reflection is used, do the following for each target:  

      1. Search for text Linker.  

      2. Double-click the Other Linker Flags setting to launch the dialog for editing this setting.  

      3. Click + and add flags -all_load , -lStdC++, and -lxml2 in the dialog.

        The character "l" in the flags is the letter "l", not the numeral "1".

    4. Click Done to close the dialog.  

  1. Make changes to the application delegate

    Prior to MicroStrategy Mobile 9.4.1 Update 1, applications that integrated with MicroStrategy had to extend their application delegate class fromMSTRMobileAppDelegate, but extending MicroStrategy’s Application Delegate class is no longer a requirement. There are now two possible options:  

    • Use MicroStrategy's application delegate as the basis for the application delegate of your application

      For new projects, extend your application's AppDelegate class from MSIAppDelegateImpl. For existing projects created with earlier releases, rename MSTRMobileAppDelegate to MSIAppDelegateImpl.  

    • Use your own application delegate instead of inheriting from MSIAppDelegateImpl

      Perform the following steps:

      1. Ensure that your application's AppDelegate class conforms to the MSIAppDelegate protocol. A sample declaration is provided below:

        Copy
        ...
        #import "MicroStrategyMobileSDK/MSIAppDelegate.h"
        ...
        @implementation AppDelegate
        @synthesize mstrAppDelegateUtils = _mstrAppDelegateUtils;
        ...
      2. Initialize the mstrAppDelegateUtils* _mstrAppDelegateUtils property declared in the MSIAppDelegate protocol in the application delegate’s init method. A sample init method is provided below:

        - (id)init {

            self = [super init];

            if (self) {

                // Initialize self

                _mstrAppDelegateUtils = [[mstrAppDelegateUtils alloc] init];

            }

            return self;

        }

         

      3. Implement the application delegate’s callback methods and notify theMSIAppDelegateUtilsobject about those events. Listed below are the methods which the MicroStrategy framework needs to be notified about. Note that final implementation of these methods depends of the actual behavior desired in the application. For example, an application might want to add some logic to the way URL handling is performed or the way notifications are handled; these customizations would require the developer to implement the logic for these actions in the implementation of the application:openURL:sourceApplication:annotation or the application:didReceiveRemoteNotification:methods respectively.

        - (void)applicationDidBecomeActive:(UIApplication *)application { 

        [self.mstrAppDelegateUtils applicationDidBecomeActive:application];

        }

        - (void)applicationWillResignActive:(UIApplication *)application {

        [self.mstrAppDelegateUtils applicationWillResignActive:application];

        }

        - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation NS_AVAILABLE_IOS(4_2) {

        return [self.mstrAppDelegateUtils application:application openURL:url sourceApplication:sourceApplication annotation:annotation];

        }

        - (void)applicationWillTerminate:(UIApplication *)application {

        [self.mstrAppDelegateUtils applicationWillTerminate:application];

        }

        - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken NS_AVAILABLE_IOS(3_0) {

        [self.mstrAppDelegateUtils application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];

        }

        - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error NS_AVAILABLE_IOS(3_0) {

        [self.mstrAppDelegateUtils application:application didFailToRegisterForRemoteNotificationsWithError:error];

        }

        - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo NS_AVAILABLE_IOS(3_0) {

        [self.mstrAppDelegateUtils application:application didReceiveRemoteNotification:userInfo];

        }

        - (void)applicationDidEnterBackground:(UIApplication *)application NS_AVAILABLE_IOS(4_0) {

        [self.mstrAppDelegateUtils applicationDidEnterBackground:application];

        }

        - (void)applicationWillEnterForeground:(UIApplication *)application NS_AVAILABLE_IOS(4_0) {

        [self.mstrAppDelegateUtils applicationWillEnterForeground:application];

        }

      4. Update the navigation controller reference

        Certain functions of the MicroStrategy Mobile framework are performed by pushing view controllers onto a navigation controller. The MicroStrategy Mobile framework creates a NavigationController that can be used in the custom application. This navigation controller is the default navigation controller where the MicroStrategy framework performs the push actions. You can define your own custom navigation controller as well.

        The MSIAppDelegate calls the updateMSTRStartViewController:startViewController method when it is initialized. The parameter passed in this method is the default navigation controller generated by the framework. You can keep a reference to it if it is desired. The following snippet shows how to set this navigation controller as the application’s root view controller.

        - (void)updateMSTRStartViewController:(UIViewController *)startViewController { 

        [self.window setRootViewController:startViewController];

        }

        If you are using a different navigation controller where MicroStrategy content is presented, you must update the reference to this navigation controller via the following API:

        //In this snippet, we create a custom navigation controller where the content will be presented

        UINavigationController *customNavigationController = [[UINavigationController alloc]init];

        [[Generic getMSTRAppContext] setCustomizedNavigationController:customNavigationController];

        Applications developed prior to 9.4.1 must be updated using either of the two approaches described above.

  2. Build the project to confirm that it compiles successfully

    From the Product menu, select Build. Confirm that compilation was successful.  

The project is now ready for use.