App Development and Execution (iOS)

Preparation

You need to make below preparations for developing and deploying an iOS app. If you want to know details on each preparatory step, please see the guides provided by Apple.

If you have developed your application with Nexacro Studio and want to launch it on a device, you need to build your application in the form of an installable app. To this end, you need Xcode and the iOS SDK.

Nexacro Platform 14 Administration Guide refers to Xcode 7.3.1.

Some menus and relevant actions may change later with version updates.

App Project Development and Build

This section goes over the steps for developing application projects for iOS on Xcode. Before starting an app project, ensure that archive files created by an application developed on Nexacro Studio already reside on a designated path.

Creating Projects

You need to create an iOS project for the applications you develop with Nexacro Platform, and configure the basic environment. Create a new project by selecting:

File > New > Project

Select the Single View Application item when prompted with Choose a template for your new project.

스크린샷 2013-09-12 오전 11.26.19

Enter the Product Name and other related information. Click the Create button after specifying a location where the project will be created.

스크린샷 2013-09-12 오전 11.27.18

You should add a launch screen storyboard to your project to prevent your application from having empty spaces on the top and bottom of a screen when it runs on iPhone X.

If you want to see further information, follow the below links.

https://developer.apple.com/ios/update-apps-for-iphone-x/

https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/launch-screen/

Nexacro Platform Library Settings

Nexacro Platform library files are set up to create an optimal environment for your iOS project. Select a project and add a "Frameworks" folder.

Nexacro Platform libraries are provided in the nexacro14.framework.zip file. When unzipped, the libraries are moved to the frameworks of the newly created project.

스크린샷 2013-09-12 오전 11.37.56

Additional Library/Framework Settings

You can configure additional libraries and frameworks required for using APIs on iOS. When you select the Frameworks folder under the project and then select TARGETS, you will see Build Phases on the top of the screen. Select the relevant tab and then select Link Binary With Libraries. You can see the added Nexacro Platform libraries.

스크린샷 2013-09-12 오후 1.07.35

Add 14 items by clicking + button on the button. The items to be added are as follows.

libz.1.2.5.tbd

libsqlite3.0.tbd

MessageUI.fremawork

SystemConfiguration.framework

CoreMedia.framework

MobileCoreServices.framework

QuartzCore.fremawork

MediaPlayer.fremawork

CoreLocation.fremawork

CFNetwork.fremawork

AVFoundation.fremawork

AudioToolbox.framework

AddressBookUI.fremawork

AddressBook.fremawork

The below two items should be added if you use a Nexacro Platform version released after June 2015.

Security.framework

libc++.tbd

Select the libraries/frameworks added immediately under the project and drag them under the Frameworks folder.

Resource Settings

The various resources to be used with project application must be configured, such as images, icons, messages and layouts.

Icon Image Settings

You can specify an icon and splash image for your iOS app. You can use existing files. Select the project, choose your target and then click the General tab on the top.

Click the arrow button to the right of App Icons Source, which is located under the "App Icons and Launch Images" section, and drag app icons to the image wells that match their resolutions in the project navigator.

The below table presents the image sizes for each icon type.


1x

2x

3x

20pt (Notification icon)

20px x 20px

40px x 40px

60px x 60px

29pt (Settings icon)

29px x 29px

58px x 58px

87px x 87px

40pt (Spotlight icon)

40px x 40px

80px x 80px

120px x 120px

60pt (iphone icon)


120px x 120px

180px x 180px

76pt (iPad icon)

76px x 76px

152px x 152px


83.5pt (iPad Pro icon)


167px x 167px


Splash Image Settings

Create a folder in the project and add images in it for the use of splash images. If the image is simple, you can use just one size (750px x 1334px) for all types instead of creating multiple images for each resolution.

Create an asset catalog in Xcode for the use of splash images.

Editor > Add Assets > App Icons & Launch Images > New iOS Launch Image

Select a file that matches in size or create a file sized in 750px x 1334px. Then, drag the file to image wells in the project navigator.

Select the project, choose your target and then click the General tab on the top. Click the Use Asset Catalog button next to Launch Images Source and then click [Migrate] in the dialog that appears. Select the newly-created asset catalog from the list of launch images sources and then remove the value of Launch Screen File.

Message Settings

Message setting configures messages used for running apps.

  1. Create a new file under the Supporting Files folder by selecting the folder and clicking New File on the context menu.

  2. Select String File among the listed templates.

  3. Enter the file name as Localizable.

스크린샷 2013-09-13 오전 10.55.46

  1. Select the created file and click the Localize button in the right window and select your desired language.

스크린샷 2013-09-13 오전 10.57.46

Select the project and then the Info tab to see the selected language added to the Localizations item. You can add languages to the project folder by selecting the + button at the bottom.

스크린샷 2013-09-13 오전 11.04.57

Revise the created Localization.strings file as follows. Revise the added languages appropriately, as well.

"needupdate" = "It is need to update.";
"loadingFail" = "First loading is fail.  \r\nPlease restart.";
"updateFail" = "Update is fail.  \r\nPlease restart.";
"notexist" = "Start file is NOT exist.  \r\nPlease restart.";
"BeingUpdated" = "Being updated.";
"wantreplace" = "There is a file of the save name. Do you want to replace? ";
"ok" = "OK";
"cancel" = "Cancel";
"move" = "Move";
"upper" = "Upper";
"filter" = "Filter";
"home" = "Home";
"nofilename" = "No File Name.";
"checkforupdates" = "Check for updates.";
"installforupdates" = "Install for updates.";
"downloadingforupdates" = "Downloading for updates.";
"force_close" = "Update is Completed.";

Modifying Code Files

Edit the AppDelegate.h, AppDelegate.m and main.m files as suggested here. These were generated when you created the iOS project.

AppDelegate.h

Edit the created application delegate, AppDelegate.h, so that it inherits the Nexacro Platform AppDelegate. Revise the related files so that the nexacro14.framework will run.

#import <UIKit/UIKit.h>
#import <nexacro14/NexacroAppDelegate.h>
#import <nexacro14/NexacroMainViewController.h>

@interface AppViewController : NexacroMainViewController
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
@end

@interface AppDelegate : NexacroAppDelegate <UIApplicationDelegate>
-(NexacroMainViewController*)initMainViewController:(NSInteger)nView;
@end

AppDelegate.m

Part of the AppDelegate.m file defines a server URL where the start_ios.json file created on Nexacro Studio is distributed.

#import "AppDelegate.h"

@implementation AppViewController
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    //return NO;
    return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
@end

@implementation AppDelegate
-(NexacroMainViewController*)initMainViewController:(NSInteger)nView
{
    [[NexacroResourceManager sharedResourceManager]setBootstrapURL:@"http://172.10.10.10:8080/nexacro/start_ios.json"];
    return [[AppViewController alloc] initWithLoader:nView];
}
@end

main.m

Revise the main.m file under the Supporting Files folder as follows.

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

Build Environment Settings

Build Settings

Settings for some of the items in Build Settings should also be revised.

Build Settings > Linking > Other Linker Flags

Debug

-lxml2

Release

-lxml2

Build Settings > Search Paths > Header Search Paths

Debug

/usr/include/libxml2

Release

/usr/include/libxml2

Build Settings > Architectures > Build Active Architecture Only

Debug

No

Release

No

Build Settings > Architectures > Vaild Architectures

Debug

armv7 armv7s

Release

armv7 armv7s

Build Settings > Apple LLVM *.* - Language - objective C

Objective-C Automatic Reference Counting

No

Build Settings > Build Options

Enable Bitcode

No

스크린샷 2013-09-13 오전 11.51.04

With the increase in the version of iOS, you may need to configure settings for allowing user permissions for certain features. Moreover, the addition of new features requires you to configure relevant settings. In addition, you need to set architectures according to the versions of iOS.

ARMv7 : iPhone 3GS, iPad(2010), iPhone 4, iPod touch, iPad2, iPhone 4S, (new)iPad, iPad mini

ARMv7s : iPhone 5, iPad(2012), iPhone 5c

ARM64 : iPhone 5S, iPad Air, iPad mini 2, iPhone 6, iPhone 6 plus, iPad Air 2, iPad mini3

Info

You can check the settings of your app in the Info tab. Bundle name represents the name of you app while Bundle identifier is the ID value of your app.

Info.plist

Modify the Info.plist file. Add the "App Transport Security Settings" dictionary and then add the Allow Arbitrary Loads key under the dictionary. Set the value of the key to YES. Lastly, add the "View controller-based status bar appearance" key and set the value to No.

Add privacy-sensitive data classes to info.plist including location usage, camera and photo library.

Code Signing

When you use a simulator for testing, there is no need for authentication. However, an additional setting is required to connect to an actual device.

Set the Code Signing Identity property in Code Signing with an appropriate profile.

스크린샷 2013-09-13 오후 2.45.54

Configure a provisioning profile at "Provisioning Profile".

You can check available certificates in your keychain while you can check your provisioning profile at the Xcode's menu Preferences > Accounts.

App Test

You can test an application directly by connecting the iOS device to a PC using a USB cable, or by connecting the device to a simulator.

  1. Install an appropriate profile on the device by selecting the target.

스크린샷 2013-09-13 오후 2.30.20

Execute the test Xcode by clicking the run icon on the top of the screen or accessing Product > Run.