App Development and Execution (macOS)

You can distribute a service developed based on Nexacro Platform to Mac users in the form of a Nexacro Platform Runtime Environment (NRE) app. As an administrator, you need to create deployment files based on a project made by developers. This chapter briefly explains how to create deployment files step by step.

Preparation

Development environment

You need the Xcode development environment to create an app for macOS. Without addition coding, you just need to go through few steps to make an existing Nexacro Platform-based app applicable to macOS.

The below table shows the basic elements of the development environment for macOS apps.

Elements

Description

Xcode

You may need installation.

https://developer.apple.com/xcode/

xcodebuild

This element is installed automatically when Xcode is installed.

Develop App Project

Follow the below steps to work on a macOS app project in Xcode. Before entering an app project, you should find the archive files in an app that you built in Nexacro Studio and locate them in the designated directory.

Create a project

After creating a macOS project that will contain your Nexacro Platform-based app, configure basic settings. You can create a project by accessing the below menu.

File > New > Project > macOS

Select Cocoa App as a template for the created project.

Set Language to "Objective-C" and set other options including Product Name. Then, click the Create button after designating the folder where the new project is created.

Set Nexacro Platform libraries

Add Nexacro Platform libraries to your macOS project to establish an optimal environment for Nexacro Platform.

Nexacro Platform libraries are provided in the form of a compressed file named nexacro17.macOS.framework.zip. After decompressing the zipped file, bring the libraries to any folder in your project or add them by accessing the menu Add Files to.

File > Add Files to "..."

Set resources

In this stage, you can set launch images, icons, messages and layouts applied to your app. You can adjust those options according to projects.

Add image files in the Copy Bundle Resources phase and then modify the main.m file as presented under the below picture.

startManager.splashImageName = @"rezero.jpg";

Set build environment

Delete the AppDelegate.h, AppDelegate.m and MainMenu.xib files, which are created by default but not used.

main.m

Find the main.m file located under the Supporting Files folder and modify it as below.

//  main.m

#import <Cocoa/Cocoa.h>
#import "nexacro17/nexacro.h"

int main(int argc, const char * argv[]) {
    NexacroStartManager *startManager = [NexacroStartManager sharedManager];
    
    // If omitted, the name of the app is used automatically.
    startManager.applicationKey = @"";
    
    // This is a required value. If you use the default bootstrap file name, you do not need to specify start_macos.json.
    startManager.bootstrapUrl = @"http://172.10.12.180:8080/Mobile_Test/start_macos.json";
    
    // If omitted, the URL is the same as the directory where the bootstrap file is located.
    startManager.projectUrl = @"http://172.10.12.180:8080/Mobile_Test/";
    
    // Set launch screen (Refers to the resources folder. If omitted, the default launch screen of Nexacro Platform is used.)
    // startManager.splashImageName = @"sample.png";

    [NSApplication sharedApplication];
    [NSBundle loadNibFile:[startManager getNexacroNibFile] externalNameTable:nil withZone:nil];
    [NSApp run];
    
    return EXIT_SUCCESS;
}

Other settings

General

Deployment Target: 10.7

Main Interface: delete MainMenu

Build Settings

Architectures: $(ARCHS_STANDARD)

macOS Deployment Target: macOS 10.7

Objective-C Automatic Reference Counting: Yes

32-bit apps are deprecated in the macOS version released in 2018. From 2019, 32-bit apps are no longer compatible with macOS just like iOS 11.

If you do not set Allow Arbitrary Loads to "YES", a WebBrowser component will not be displayed on the screen.