Home > Mobile >  issues with TextField xcode on macos big sur on not-upgradable-anymore macbook air 2014
issues with TextField xcode on macos big sur on not-upgradable-anymore macbook air 2014

Time:07-10

XCode 13.2.1 has issues not sure how to overcome on older hardware.

macbook air 2014 cannot upgrade to any macos past big sur.

doing a clean install (Cmd R) recovery from the internet installing the last allowed XCode (13.2.1) still has issues, but a last supported OS last supported XCode should be giving a work-able system that lacks major issues, which I have observed:

  1. a simplest SwiftUI View that contains a TextField doesn't show the cursor nor the typed in characters when I type. This happens with the Preview and with the device simulator. I've set the project setting for IOS 14.0 iphone devices only, portrait mode only. For Previewing and for device simulator I chose iPod Touch 7th generation (inputing text in the TextField doesn't work). I also tested with device simulators for iPhone 11 and for the iphone 13 mini and they all fail to work properly.

  2. And if I try to test the code on a real device, it doesn't deploy successfully to the device any more: "failed to prepare device for development". The iPhone is an iPhone SE 1st gen and/or an iPhone X, both running IOS 15.5.

below is the simplest View to test just the TextField the device deployment of same code.

In your experience, what are ways I can keep on working on this system for an app that is targetting IOS 14 ? Is there any chance that this can be fixed by eg downloading older IOS version simulators (that perhaps are used for previewing and for device simulation) ? How do I do that if so?

=================================================

import SwiftUI 

struct ContentView: View { 

  @State var searchString: String = "" 

  var body: some View { 

    VStack { 

        Text("Hello, world!") 
          .padding() 

        TextField("dokimi: ", text: $searchString) 
          .foregroundColor(Color.red) 
          .background(Color.green) 
    } 
      .padding() 
  } 

} 

struct ContentView_Previews: PreviewProvider { 

  static var previews: some View { 

    ContentView() 

  } 

}

CodePudding user response:

The textfield input (cursor and typed text not showing) got resolved in the following way:

a. I did a clean install of MacOS Big Sur

b. then I did a

xcode-select --install

I did step b. because I need it for installing other apps with brew etc.

*** c. after the xcode tools were installed, then macos showed me there was in fact an available update for Xcode tools 13.2! which I was previously ignoring, thinking that Xcode installation will bring the tools it needs for the version that will be actually installed. But this time I accepted the update before installing Xcode (Xcode is installed further below using brew & mas tools)

d. I proceeded with my brew installations and mas and Xcode. For Xcode I received a pop-up that said the latest Xcode wasn't installable on my macbook air, but there was an earlier version that was. I accepted and installed the latest that was allowed (again, I am on MacOS Big Sur, not upgradable further, since laptop is 2014 macbook air).

e. (irrelevant but worth a note) I tried to download an older device simulator 14.0 from the list of available for download simulators, by clicking on the device simulator section (top center), but the download of 14.0 simulator hang in the middle with 70? % download completed, so I gave up on that.

f. After that I went straight to testing, first within the canvas preview. Even if I pressed the Run button, it wasn't showing the cursor and typed input, but this is expected behavior according to @lorem ipsum's hint (newbie mistake on my part).

g. then I tested by running the simulator with "iPod touch" device and text input worked just fine, the cursor was showing and the typed input also!

h. after that I also plugged in my iPhone (iPhone SE 1st gen running IOS 15.5) and Xcode failed to build for that device. My guess is this is expected behavior because I think the latest IOS device I've seen for this xcode is 15.2, so it is conceivable that when this Xcode was out, 15.2 was the most recent available IOS 15, and obviously I cannot expect XCode to necessarily work with future versions of IOS 15 past the version available at the time of Xcode I have.

So to summarize, TextField input works, you just need to do the input testing on the device simulator, not on the canvas, which doesn't reflect the input even when you run canvas preview with Run button of canvas.

Device building/preparation for testing on a real device, will depend on the version of IOS you have and what versions your Xcode supports, in this case the iphone is running an IOS 15.5 too far in the future for the Xcode I'm forced to work with on this non-upgradable laptop.

Hope these help someone in my shoes, thanks again to @loremipsum for the hints and suggestions!

  • Related