I am trying to add a TextField in SwiftUI. It successfully appears with the initial text, but it is not editable in the preview display, only when I run a simulator. Any ideas?
#State var smth: String = "smth"
var body: some View {
//Not editable in preview
TextField("Number", text: $smth)
}
Since the comment was a legit answer I just copy paste it here. Glad it worked for you as well
There has been an Xcode bug in the past were live preview TextField input was broken. Seems to be back :(. I just experienced the same on 13.2.1. running the preview on iOS 15.2. switching to an iOS 14.3 simulator seems to fix it in my case. (wait for the Preparing iPhone Simulator for Previews to finish). Related to
I just download Xcode 13.3.1, and MacOs 12.4 Beta, and now I can use the physical keyboard for enter data in a TextField on a preview.I don't know if you can download only Xcode 13.3.1 without downloading the MacOs 12.4 Beta, or if Xcode 13.3.1 download alone resolve the problem.
I'm currently using Visual Studio Community on Windows (connected to Mac) with Xamarin.IOS 15.0.0.8 (the same version installed on MAC).
After updating Visual Studio to the version 16.11.4 and deploying the xamarin forms app to my physical device (Iphone X) i can notice that:
Shell.BackgroundColor is not blue and also the hamburgher icon menu not appear.
if i deploy the same app to the android emulator everything is working correctly.
I attach this image to explain
What do you think ?
According to my query, it seems that uikit has been updated in ios15. The default color is transparent.
I added in the FinishedLaunching method of xxx.IOS->Appdelegate.cs:
UINavigationBar.Appearance.BackgroundColor = UIColor.Blue;
I'm trying to create a new XCode project, plain brand new and I can run it on the simulator, but on the canvas it says: Cannot preview in this file - active scheme does not build this file
If on top of that I start adding macOS support, it says:
'appName' is annotated with #main and must provide a main static function of type () -> Void or () throws -> Void. It also says:
Cannot find type 'App' in scope
Cannot find type 'Scene' in scope
Regarding mac support I was reading there is a workaround, even though I tried and the error remains.
As for the active scheme, I read this, but doesn't help. I mean... there is only 1 scheme in a new project and it's selected automatically
I would assume a plain hello world project would work, what's going on?
SwiftUI 2.0 on macOS is available only starting from Big-Sur macOS 11.0
#available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
public protocol App {
^^^^^^^^^^^^
Regarding the macOS support is what Asperi mentioned, on Catalina has problems supporting mac on XCode 12.
As for the new project failing, I found that if I press Cmd + Opt + P, it would build it on the Canvas fine. I had tried clicking "Try again" on the canvas which I would assume is the same and didn't work. You don't need to delete the file and create a new one nor select any target since it's a new project and the target is selected automatically.
Also the #Main doesn't have to be changed to run on iOS and iPad, for macOS support just wait until Big Sur releases.
As I have developed the iOS application using Xcode 7.3.
When reviewing the AutoLayout constraint on the device which having iOS 10 using Xcode 7.3 it properly display it but when using the Xcode 8 and then reviewing on the device then it does not show properly.
So my question if I am deploy the application on the AppStore using Xcode 7.3, so there is any chance that the AutoLayout constraint do not show properly in iOS 10.
Any help is much appreciated.
I am having the same issues in one of my iOS application as the constraint works in Xcode 7.x but not in Xcode 8, so I have found some work around for resolve it. Please find the below steps.
1) Open your storyboard in Xcode 8, then it popup regarding choose an initial device view, please select one of the option and then click on Choose Device. Please find the below GIF representation for same.
2) When you complete your changes, select the storyboard, go to File Inspector, on Interface Builder Document section, select the Opens In field and apply the Xcode 7.x. After that it popup regarding save so please select "Save and Close" option when it is prompted. Please find the below GIF representation for same.
3) Close the Xcode and then open the application.
Your storyboard changes will be saved, and your storyboard will function as it did on Xcode 7.x.
Hope it works for you!!!
The build given by Xcode 7.3 will not affect for constraint issue on iOS10.
I don't know why but now the default iphone simulator launched when I build the project is "ipad", but I want it to use iphone 3g instead.
Any way to set this preference?
On Mac, if you right click on the Simulator icon, you can select devices and it will open a new device.
Or go to File -> Open Simulator
In Xcode,
Click Product -> Destination -> iOS Simulator -> Choose Device to run.
Then build and execute Xcode project.
It works..
2022 Fix:
You have two options!
With the simulator running go to File > Open Simulator > iOS [current version] and select the desired device.
With the simulator running, right click the icon in the bottom toolbar, select Device > iOS [current version] and select the desired device
If you are using Expo, after selecting the new device will open in a new window, so you'll have both. Heres how to get Expo to run on the new device:
Close the device window you don't want (cmd + w)
You will now be able to "Run on iOS Simulator" and it will open up Expo Go on the new device.
2020 Fix:
With the simulator running go to File > Open Device > iOS > iPhone 11 and select the device. It will open up the device as another window but there won't be the Expo app.
Close the device window you don't want (cmd + w), then close the window with the device you would like.
Restart Expo (in the command window with it running do ctrl + c then re-run Expo with expo start
You will now be able to "Run on iOS Simulator" and it will open up with the selected device type.
In the chance that anyone reading this is building their app in react-native, the solution is the --simulator option.
For example:
$ react-native run-ios --simulator "iPhone X"
Go to Hardware > Device from simulator menu.
For me works changing active SDK from 3.2 to 4.0. If your project is mentioned to work on iPad and iPhone (or for compatibility matters) I believe the only way is manually switching active executable before running your app on simulator.
Apple:"iPhone OS 3.2 does not support iPhone and iPod touch devices. It runs only on iPad.".
You can select the device from the menu inthe simulator.
Try
Project > Active Executable , and select the one you want the most.
This worked for me. When I already have the app open on an iphone in "Simulator". I click File -> Open Simulator -> iOS 14.0 -> iPhone 8 (or iPad (7th generation))
None of the above worked for me, but the following took care of the issue :
Source:
http://www.cocoabuilder.com/archive/xcode/301182-xcode-3-2-6-keeps-switching-to-ipad-simulator.html
Excerpt:
This works for Xcode 3.2.6. I don't yet use Xcode 4.x so don't know
if this will work for it or not. I would also quit Xcode before doing
this, just in case.
Go to the project folder and find the .xcodeproj file. Right-click
(or Control-click) it and select Show Package Contents. When the
package contents window appears, find the .pbxuser file (there might
be multiple such files if the project was worked on by multiple folks
and/or multiple computers). Open this file, which is XML, in your
preferred text editor. Find the section with the comment "/* Project
object */". There is most likely not a line in that section for the
key "activeSDKPreference". If there is no such key, add the
following:
activeSDKPreference = iphonesimulator4.2;
I found it after the "activeExecutable" key in that section, so I've
been adding it in that same order.
If there is already an "activeSDKPreference" entry, change it to
"iphonesimulator4.2".
Close the editor and the package contents window and then double click
the .xcodeproj file to reopen the project. Now you should have
entries for iPhone Simulator 4.2 and iPad Simulator 4.2 in the project
settings pull down menu, with iPhone Simulator 4.2 probably already
checked.
Additional Notes:
In my particular case, my entry in .pbxuser file had said
iphonesimulator4.3, even though under Project-Project Settings
menu
it said iphonesimulaor4.2!. However, once I changed it to
iphonesimulator4.2 in the .pbxuser file it stop auto selecting
iPad
all the time.
If you use SVN you will not see an "M" in SVN column showing that
you changed the project (even if you refresh/update). However,
just
do a "Commit Entire Project" and your changes to .pbxuser file
will
get updated. I also suggest referencing this post in your
check-in
comment in case you ever need to change it back for whatever
reason.
I finally solved this problem myself.
First, install new version of Xcode, which is Xcode 4.
Then set project scheme to iPhone Simulator and run app in Xcode several times.
And re-install Xcode 3 and the problem will be gone!
Yes, it's annoying. This worked for me:
Open the .plist file in group/folder resources and check the checkbox for key "Application requires iPhone environment".
If you are using Flutter, open the Runner.xcodeproj file in ios/ folder. Then right next to the Runner breadcrumb, you can click >and select what device to launch.
For Xcode Version 3.2.6 the following helps:
Project->Active Executable->iPhone Simulator 4.3
I don't know if it is working for newer Xcode environments.
Gary Tsui has also pointed out this approach previously.