ML Image Classifier not giving expected results on simulators


I created an Image Classifier app, “Chichibu Unkai Watcher”, and it returns right results on a real iPhone device. Also it returns right results on mac catalyst. But, I found that the iPhone/iPad simulators do not return expected results.

XCode Version 13.1 (13A1030d)
Simulator Version 13.1 (970)
Create ML Version 3.0 (78.6)

Fig.1 iPhone real device: Unkai confidence level is ~0%.
Fig.2 mac app on macOS Catalyst: Unkai confidence level is ~0%.
Fig.3 iPhone Simulator: Unkai confidence level is 69%
All of those are using a same image data, and the Unkai confidence level should be ~0%.


I tried some GPU settings on the simulator app, also some compiler settings changes, but it does not resolve this symptom. I found an article on the Stack Overflow which says it might be caused by the simulator. At this moment, I’m assuming this is caused by the simulator.


Per Sheldon, he is suggesting to run one on a real device.

Fig.1 iPhone real device

Fig.2 mac Catalyst app run on a real mac

Fig.3 iPhone Simulator

Message from debugger: Terminated due to signal 9


Create a SwiftUI app which support two languages (ex. English, and Japanese). Run it in the simulator with debug mode. In the simulator, from the “Settings”, switch the language to another language.Then, XCode displays “Message from debugger: Terminated due to signal 9”.


It happens even if a simple initial app as shown below. When the simulator switches a language to another, it restarts the some process and it might disconnect the debug communications. I think it can be ignored in this case.

import SwiftUI

struct ContentView: View {
    @State var message = "Hello, world!"
    var body: some View {

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {

SwiftUI: ForEach, forEach, for in の違い

SwiftUIでは、ForEach, forEach, for in の動きが異なります。

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            // OK
            // SwiftUI の ForEach は View を返すので OK
            ForEach(1..<5) { i in Text("hello") }
            // Error: Closure containing control flow statement cannot be used with result builder 'ViewBuilder'
            // クロージャーを持つ制御文は 複数のView を構成する ViewBuilder として使えない
            // 要は、次のように複数の Text からなる View を構成することができない
            for i in 1..<5 { Text("hello") }
            // Error: Type '()' cannot conform to 'View'
            // forEach は View を返さない
            [1,2,3,4].forEach{ d in Text("hello") }

XCode UnitTest Error : Multiple commands produce …


  1. Create a project.
  2. Add a new target with Swifter by pod install
  3. run a unit test, then Multiple commands produce … error comes up.


Error Message is as follows.

Multiple commands produce …..
1) Target ‘appname’ has … /’
2) Target ‘appname_Twitter (iOS)’ has…./’

It means, there are two files with for two different targets.


Rename one of the product name, and clean rebuild.
In my case, I renamed my app with Swifter from TARGETS >> Build Settings “Product Name” from appname to appname2.