CATEGORY

iOSApp

  • 2020-03-08
  • 2020-03-27

2020/03/27 Update: Requirements to Release On App Store Since April 30, 2020

Deadline for existing app updates has been extended to June 30, 2020. The article posted on March 30, 2020. Apple Developer News and Updates sites says that following two things will be required to release your apps on the App Store since April 30, 2020. Build with iOS 13 SDK or later Create the launch screen with a storyboard iPhone Apps support all size of iPhones On Apple Developer News and Updates, two articles has been post. These articles say same things. The difference is whether they are writing about iOS 13 or iPadOS. The required changes are the same for both operating systems. Build your app with iOS 13 SDK or later iOS 13 SDK is contained in Xcode 11. You need to build your app with Xcode 11 or later since April 30, 2020. If you want to see which version of SDK that Xcode has, see next article. If you write all code of your app by yourself, there is a no problem. If your app has third party SDK, and they are linked with old SDK, the App Store will not accept your app. You can use otool to check the SDK which is linked by […]

  • 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-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-18

Which class is better? WKWebView or SFSafariViewController?

In general, The WKWebView class is better choice when you replace the UIWebView class. However, in some cases, the SFSafariViewController can be better choice. Better class is decided by the requirements Which class is better? You may want to consider following: An app want to do something when read the web page. An app want to know the URL of the web page. An app want to execute the JavaScript on the page. If your app fit to above, your app should use WKWebView. SFSafariViewController can’t do above. Is the requirements really needed? “My app want to do “Something” when read the page”. Is it really needed? For example, your app want to open the specified URL, or want to execute JavaScript to only close the view? It may be enough that by placing the close button on the navigation bar. In some cases, An app display the login page, and received the specified URL, an app close the view. In this case, especially with the OAuth2, you can set the redirect URL to the custom URL Scheme (Deep Link), UIApplicationDelegate can respond to it. You can use SFSafariViewController in this case. Is opening the browser really good UX? Your […]

  • 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. ( https://www.apple.com/ ) 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.

>現役のプログラマーが書くプログラミング情報

現役のプログラマーが書くプログラミング情報

日々の開発の中での学びや分かったこと、調べたことなどを書いていくブログです。

CTR IMG