• 2020-02-28
  • 2020-02-28

How To Support Notarization Services For Installer

If the application is packaged into the installer package and it is deployed, the installer package also need to support the Notarization Services. This article explains that how to support Notarization Services for the installer. Overview of How to make the installer The installer of macOS is created with following 2 steps. Create the component package with pkgbuild. Create the deployment installer with productbuild. If the deployment file is disk image format, the step to create the dmg file with hdiutils will be followed. And you will upload it to the Apple Notarization Services. Prerequirements of the Notarization In prerequirements of the notarization, following things are related to the installer. Code-sign with the Developer ID Application Certificate or the Developer ID Installer Certificate. Contains the secure-timestamp. I have used Developer ID Installer Certificate. I don’t know the Developer ID Application can be used. The Component Package and The Deployment Installer The deployment installer consists with some of component packages. The component package is created per selection of the custom install. The custom install is a function that the user can select to install or skip. If the installer only have express install and doesn’t have a custom install, required component […]

  • 2020-02-25
  • 2020-02-28

Introduction to Combine | How to connect to the Web Server with the Combine

This article explains that how to connect to the web server with the Combine. Create the Publisher of the DataTask Create the publisher of the data task to connect to the web server. Two methods are available to create it: The first method has an argument “URL”. If you want to simply connect to the URL and GET the contents, you can use this method. The second method has an argument “URLRequest”. With “URLRequest”, you can set the method of the HTTP, the body data, the header value and so on. You can handle most cases, but if wan to download the large file, you should use the download task of URLSession directly. Receiving Result To receive the result, use sink method. Returned value need to be keep in anywhere. You can write the code in following form: Keep in mind the thread Closures are executed on the sub-thread. Updating the GUI need to be executed on the main thread only. Sample Code Following code is a sample code. Enter the URL and tap the “GET” button, the application get the content from the URL with Combine. This code uses SwiftUI, you can copy & paste to the ContentView.swift and […]

  • 2020-02-24
  • 2020-02-28

Introduction to Combine | How to support Combine in a custom class

Combine is a framework to implement asynchronous operations. It is created by Apple, it is also used in Swift Data Binding. It is an important framework. If you new to Combine, see next article. If you want other samples, see following articles. This article explains how to support Combine in a custom class. Adopt to ObservableObject protocol. To make a class to support Combine, adopt to ObservableObject protocol. To notify a changes of properties with Combine, mark the property with @Published attribute. @Published The property which is marked with @Published attribute, can make the Publisher. Use $ operator to make the Publisher. Receive changes of properties of a custom class Use sink() to receive changes. The value of the property is not changed at the block is executing, so the value of the property is an old value yet. You should use a block argument “value”. Sample Application I made a sample application. “Hit” button decrement HP and “Heal” button recover it. I think this code will make you understand an effect of the ObservableObject.

  • 2020-02-23
  • 2020-06-30

How To Configure the project with Xcode to support Apple Notarization Service

March 6, 2020  In “How confirm the program satisfied requirements”, --strict option was missing, added it. There are some way to support Apple Notarization Service. From February 3, 2020, if the app want to be notarized, the app need to meet the original notarization prerequisites. This article describe that how to configure the project with Xcode. Notarization Prerequisites Notarization Prerequisites are following: All Executables are need to be code signed. Enable Hardened Runtime of all of the applications and the command line tools (CLI). Use “Developer ID Application Certificate”, “Developer ID Kernel Extension Certificate” or “Developer ID Installer Certificate” to code signing. Include a secure time stamp. “” or variations are not contained in the entitlement. Linked to macOS 10.9 SDK or later SDK. Code Signing to Executables Configure to sign the executable. Configuration of the application target and the CLI target Set the “Code Signing Identity” to “Developer ID Application” certificate. If you manage the certificate by yourself, set the “Code Signing Style” to “Manual”, “Development Team” to the empty and “Provisioning Profile” to “none”. Configure to sign on copy In the application target configuration, configure to sign on copy frameworks. METHOD 1 : Configure in the General tab […]

  • 2020-02-22
  • 2020-03-02

The UI Testing of the Mac App – Test the Dialog

This article says about the test of the dialog with the UI Testing. Wait until appear The dialog will be opened when you click the button, launch the application, select the menu item and so on. The dialog will be appeared by many ways. However, there is a common thing, waiting until appear. The time interval is slightly changed by the machine spec or the state of the machine. To wait until the dialog appeared without effects from them, the code can be following:

  • 2020-02-21
  • 2020-02-21

Change the mock object with a command line argument

The UI Testing is powerful function that Xcode has. The UI Testing is the one of the unit test, it generate events such as the mouse down event or a key down event, the application responds to them same as user operations. It tests the user interface such as a window content. How ever, it is hard for me. For example, the mock. The mock is used to test functions that are hard to automatically test. For example, the function to communicate with a web server or the real devices. The mock returns results that the application want without real communication with the real servers or devices.. You need to test functions that are replaced with the mock, but it is not important when you test the user interface. To use the mock, the application use a protocol instead of a real class. For example, when the application communicates with the web server which has APIs, create the API protocol, the real class is adopt to this protocol. Also, the mock is adopt to this protocol, then you can use the mock when you test. There is a problem. How to replace with the mock? Use a command line argument […]

  • 2020-02-21
  • 2020-07-18

Update 2020/07/18: System Requirement of Xcode

2020/07/18: Added the Xcode 11.6. When you develop an application which supports old OS, which version of Xcode you should use? This article list up a system requirement of Xcode. System Requirement of Xcode System Requirement of Xcode 11 This list is a system requirement of Xcode 11. Xcode Supported System Platform SDK Debug On Device Xcode 11.6 macOS Catalina 10.15.2 or later iOS 13.6, iPadOS 13.6, tvOS 13.4, watchOS 6.2, macOS Catalina 10.15.6 iOS 8 or later, tvOS 9 or later, watchOS 2 or later Xcode 11.5 macOS Catalina 10.15.2 or later iOS 13.5, iPadOS 13.5, tvOS 13.4, watchOS 6.2, macOS Catalina 10.15.4 iOS 8 or later, tvOS 9 or later, watchOS 2 or later Xcode 11.4.1 macOS Catalina 10.15.2 or later iOS 13.4, iPadOS 13.4, tvOS 13.4, watchOS 6.2, macOS Catalina 10.15.4 iOS 8 or later, tvOS 9 or later, watchOS 2 or later Xcode 11.4 macOS Catalina 10.15.2 or later iOS 13.4, iPadOS 13.4, tvOS 13.4, watchOS 6.2, macOS Catalina 10.15.4 iOS 8 or later, tvOS 9 or later, watchOS 2 or later Xcode 11.3.1 macOS Mojave 10.14.4 or later iOS 13.3, iPadOS 13.3, tvOS 13.3, watchOS 6.1, macOS Catalina 10.15.2 iOS 8 or later, tvOS 9 […]

  • 2020-02-18
  • 2020-02-27

(Swift|ObjC) How to replace UIWebView with WKWebView

On December 23 2019, the following article was post to the Developer News And Updates: Updating Apps that Use Web Views According to that, the App Store will no longer accept the app using UIWebView. I also post the following article: From now, WKWebView and SFSafariViewController are recommended. This article describes how to replace UIWebView with WKWebView. Load the web page From URL The code to load the web page from the specified URL with UIWebView is following: // Swift // With UIWebView func load(url: URL) { let request = URLRequest(url: url) uiWebView.loadRequest(request) } // Objective-C // With UIWebView - (void)loadWithURL:(NSURL *)url { NSURLRequest *request = [NSURLRequest requestWithURL:url]; [self.uiWebView loadRequest:request]; } With WKWebView, the code is following. It is very similar. // Swift // With WKWebView func load(url: URL) { let request = URLRequest(url: url) wkWebView.load(request) } // Objective-C // With WKWebView #import <WebKit/WebKit.h> - (void)loadWithURL:(NSURL *)url { NSURLRequest *request = [NSURLRequest requestWithURL:url]; [self.wkWebView loadRequest:request]; } From Local HTML The code to load the local HTML which is presented by the string with UIWebView is following: // Swift uiWebView.loadHTMLString(html, baseURL: baseURL) // Objective-C [self.uiWebView loadHTMLString:html baseURL:baseURL]; With WKWebView is following. The difference between them is whether the result value is […]

  • 2020-02-18
  • 2020-02-28

UIWebView will be no longer accepted

To use the embedded web browser in an iOS App, you have three choices: UIWebView Class WKWebView class SFSafariViewController class The long time past since the UIWebView class have been deprecated, now, The AppStore will be no longer accept apps that are using the UIWebView class. Updating Apps that Use Web Views According to above post, the AppStore will be no longer accept new apps are using UIWebView class as of April 2020, app updates using UIWebView class as of December 2020. The way to replace UIWebView to WKWebView, review following article. What to do? Basically you need replace UIWebView with WKWebView, but in some case, you can use SFSafariViewController. For example, if your app simply show the support web site or the login page which is using OAuth2, you can use SFSafariViewController. SFSafariViewController has a feature of Safari. When you display login page are using OAuth2, you set the redirect URL to app deep link URL. The SFSafariViewController can be hidden, your app may hides SFSafariViewController and shows the progress indicator. If you are not sure which class is better, see the next article:

  • 2020-02-18
  • 2020-02-18

How to create the Apple ID for Development

To develop the iOS App, you need the Xcode which is IDE (= Integrated Development Environment). You can freely download it from the Mac App Store. The Mac App Store needs Apple ID. You can also create Apple ID free. It is better that create the Apple ID for Development You can use Apple ID that you using usually to download Xcode. I have been using usually Apple ID to purchase apps. However, it is better that you create the Apple ID for development to register to the Developer Program than using usual Apple ID. For example, To avoid problems from beta OS, especially from iCloud. If your native language is other than English, it is better that name, address and so on are written in English than your native language to avoid unexpected bugs. How to create the Apple ID You can create the Apple ID by follow these steps: Open the Apple Web Site. ( ) Click “Support” link. Click “Apple ID” link. Click “Go to your Apple ID account page” link. Click “Create your Apple ID” link. Follow to the page.