.Net7 MAUI app unable to debug/publish with iOS16/Xcode 14 - maui

I can debug on MyMac (Mac Catalyst) no problem but not on the simulator, I get the following errors in the Application Output:
xcodebuild[4480:64944] Writing error result bundle to /var/folders/wh/z7x5swm90fb6f6cxfp39760h0000gn/T/ResultBundle_2022-30-10_10-46-0020.xcresult
xcodebuild: error: SDK "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" cannot be located.
xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find simctl 2> /dev/null' failed with exit code 16384: (null) (errno=Invalid argument)
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
I'm using VS17.4 (preview 5 I think, how do I check? It just says 17.4 build 2339) and Xcode 14 for the iOS 16 SDK. I've checked in Preferences > SDK Locations > Apple and everything looks as it should... I'm a Mac noob so is there just a setting I'm missing somewhere?
If I try to build the release for publish like so VisualStudio crashes!
dotnet publish -f:net7.0-ios -c:Release
Update:
I just dropped back to net6.0 and am getting the same error. I didn't have Xamarin.Mac installed but installing it made no difference.
Below are some more component details of VS:
Xamarin.iOS Version: 16.0.0.72 (Visual Studio Community)
Xcode 14.0.1 (21336)
Xamarin.Mac Version: 8.12.0.2 (Visual Studio Community)
I can also see that the directory referenced does exist, or is it not supposed to look like that?

I had two version of Xcode installed which seems to have confused things. Uninstalling both then reinstalling 14 has fixed the issue.

Related

Flutter speech_recognition swift build error

I'm getting a build error using the flutter speech_recognition package. Try to build for iOS right now. Haven't tested Android.
I followed the installation guide. The package seem to load after modifying the .yaml file. I'm using the Visual Studio IDE on a MacBook Pro.
Launching lib/main.dart on iPhone Xʀ in debug mode...
Xcode build done. 9.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET speech_recognition OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/abcdefg/Development/flutter/.pub-cache/hosted/pub.dartlang.org/speech_recognition-0.3.0+1/ios/Classes/SpeechRecognitionPlugin.m:2:9: fatal error: 'speech_recognition/speech_recognition-Swift.h' file not found
#import <speech_recognition/speech_recognition-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone Xʀ.
From my dev directory. I can find speech_recognition directories, but the .h file is not anywhere to be found.
abcdefg-MacBook-Pro:Development abcdefg$ !find
find . -name speech_recognition
./learning_fluter/ios/Pods/Target Support Files/speech_recognition
./learning_fluter/ios/Pods/Headers/Public/speech_recognition
./learning_fluter/ios/Pods/Headers/Private/speech_recognition
./learning_fluter/ios/.symlinks/plugins/speech_recognition
./learning_fluter/build/ios/Debug-iphonesimulator/speech_recognition
abcdefg-MacBook-Pro:Development abcdefg$ find . -name speech_recognition-Swift.h
abcdefg-MacBook-Pro:Development abcdefg$
Any help would be appreciated!!
Make sure that the project has been created with the -i command as shown below: futter create -i swift [your_project_name].
after doing this verify that you are using in the properties of the runner SWIFT_VERSION = 4.2. since previous versions could cause this error.
And finally add below in podfile:
target 'Runner' do
  use_frameworks!

Cannot build any Swift project at all due to strange error about MacOSX10.11.sdk

I'm running macOS 10.12.3 with Xcode 8.3.
I cannot build any macOS Swift projects with it.
If I create a new Cocoa application Xcode project and set it to use Swift, when I try to compile it, I immediately get the following error in the "check dependencies" phase:
error: There is no SDK with the name or path '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
I have no idea what's going wrong!
The only clue I have is that earlier I created a symlink with the path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk that pointed to MacOSX.sdk in order to fix an issue where an older build of Qt that required an SDK with that path. However, deleting the symlink has no effect.
I can build Swift projects that targeting other platforms like iOS. Just not macOS.
Help!
try running this command then reopening the project
(Xcode uses xtools in the command line to build its projects)
sudo xcode-select -switch /path/to/file/
(by default the path is)/Applications/Xcode.app/
look at this pic
saw it here yesterday

Command Line Tool - Error - xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

I am getting this error while building the SwiftJSON framework to the Some Xcode project through Carthage Dependency Manager.
Sivaramaiahs-Mac-mini:GZipDemoApp vsoftMacmini5$ carthage update
--platform iOS
*** Fetching GzipSwift
*** Fetching SwiftyJSON
*** Checking out GzipSwift at "3.1.1"
*** Downloading SwiftyJSON.framework binary at "3.1.3"
*** xcodebuild output can be found in /var/folders/7m/y0r2mdhn0f16zz1nlt34ypzr0000gn/T/carthage-xcodebuild.apLXCc.log
A shell task (/usr/bin/xcrun xcodebuild -project
/Users/vsoftMacmini5/Desktop/GZipDemoApp/Carthage/Checkouts/GzipSwift/Gzip.xcodeproj
CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list)
failed with exit code 72:
xcrun: error: unable to find utility "xcodebuild", not a developer
tool or in PATH
I solved that problem by setting the Command Line Tools in Xcode. Go to:
Xcode > Preferences > Locations
And select the command line tool from the dropdown. If you have only one version of Xcode installed, there should be only one option. If you have several versions of Xcode, then you must choose the one you need.
Update (added image for reference)
The simplest fix is from CLI:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
(this should be path to your Xcode.app)
By the way this can happen even if you have only one version of Xcode . It happens when you instal homebrew before the first Xcode installation (which makes sense because you may want to install Xcode through mas install 497799835 and mas needs homebrew).
Following command worked for me
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

swift build doesn't work

I'm trying to run Kitura project on XCode. I tried to follow instructions on this page ([https://github.com/IBM-Swift/Kitura/wiki/Building-your-Kitura-application-on-XCode]), however I failed with step 3 – run swift build -X. I get this error:
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build (No such file or directory)
Looks like I have latest toolchain installed (see the screenshot below).
I also have both XCode 7.3.1 and XCode 8 beta. What would you suggest to solve that problem?
As Daniel mentioned above, Kitura right now requires use of the June 6 drop of the Swift Development toolchain. This toolchain can only be used with Xcode v7.3.1. The toolchain format changed between Xcode 7.x and newer Xcode 8 beta. When using the Xcode 8 beta with the new June 20 toolchain, there's another step that you need to do before you can run swift build from the command line.
From the command line, enter the following command:
$ sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer/
This command is necessary to inform Xcode where to find the required binaries and frameworks.
To switch it back, just use the same command but point it at non-beta version of Xcode:
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
Using these commands will eliminate the error <unknown>:0: error: Swift does not support the SDK 'MacOSX10.11.sdk' error: exit(1): that you ran into.
The Xcode 8 beta will be required to be used for all future Swift.org toolchains unless otherwise specified.
As of this writing, Kitura only compiles with the 06-06 Swift Development toolchain so make sure you have that installed.
In addition the wiki was out of date, the generate Xcode project command got renamed to swift package generate-xcodeproj. I updated the wiki to reflect this change.
Try:
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"

Swift.org issue with open source swift project. Error: xcrun: error: unable to find utility "launch-with-toolchain", not a developer tool or in PATH

I am trying to Start Xcode with the custom toolchain and to be enabled to use the open source version of Swift.
Steps are taken from Swift.org
And I receive this error:
xcrun: error: unable to find utility "launch-with-toolchain", not a developer tool or in PATH
The open source Swift toolchain from https://swift.org/download/#apple-platforms requires the latest Xcode 7.2 (currently: beta 4).
The location of the developer directory used by xcrun and other build tools must be set to this Xcode 7.2. This can be done from the command-line
with
sudo xcode-select -s /path/to/Xcode7.2-beta.app/Contents/Developer
or in the Xcode "Locations" preferences: