xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.45k stars 511 forks source link

[Meta] Xcode 14.0 Support #15954

Closed dalexsoto closed 2 years ago

dalexsoto commented 2 years ago

🚨 Update 2 ⚠️

The Xcode 14.0 support to Xamarin.iOS is now available in the stable releases of Visual Studio for Widows and Mac. Please update to the latest stable versions of both.

Thank you for your patience!

The macios team!


Update 1 # 🚨 Update ⚠️ Hello All! We have what we believe is the final build for Xcode 14.0 Support * [xamarin.ios-16.0.0.72.pkg](https://bosstoragemirror.blob.core.windows.net/wrench/6.0.4xx-xcode14/6756a11462d8aa6e73d4a320712b276caba159c1/6718459/package/notarized/xamarin.ios-16.0.0.72.pkg) If you are currently using **.NET MAUI** you will need to wait a little longer in order to use Xcode 14, as for now we highly encourage you to download Xcode 13.4.1 from the [downloads](https://developer.apple.com/download/all/) page in the Apple Developer Portal and continue to use it for now. Thank you for your patience! The macios team!

Update 0 ~Apple released Xcode 14.0 on September 12, 2022 we are working to get our Xcode 14 support release out in the meantime if you use Xamarin **we recommend you to not upgrade to Xcode 14 just yet** and keep using Xcode 13.4.1.~ ~If you updated to Xcode 14, you have 2 options:~ ~1. You can download Xcode 13.4.1 from the [downloads](https://developer.apple.com/download/all/) page in the Apple Developer Portal and continue to use it.~ ~2. Use a build from our [xcode14](https://github.com/xamarin/xamarin-macios/tree/xcode14) branch, this is where our next stable release is coming out and it includes all the iOS 15 SDKs APIs, that said we are still ironing it out.~ * ~[xamarin.ios-15.99.0.464.pkg](https://bosstoragemirror.blob.core.windows.net/wrench/xcode14/9a839d6c4a4c31a2b524fcdb721457900b396b84/6679621/package/notarized/xamarin.ios-15.99.0.464.pkg)~ ~We will keep this issue updated as we go to have the final builds declared.~ ~If you are currently using **.NET MAUI** you will need to wait a little longer in order to use Xcode 14, as for now we highly encourage you to use option 1 above.~ ~Thank you for your patience!~ ~The macios team!~
Adam-Langley commented 2 years ago

Hi @dalexsoto Can you please answer the original question in the original thread #15946 ?

"Where is the definitive source of truth, a page that is kept up to date, indicating compatibility with Xcode?"

Let's resolve the root issue which is the lack of documentation surrounding how to know whether it is safe to do any Xcode upgrade - i.e, a compatibility matrix between the Xamarin, and Xcode releases.

Thanks for your time

dalexsoto commented 2 years ago

Hi @dalexsoto Can you please answer the original question in the original thread #15946 ?

"Where is the definitive source of truth, a page that is kept up to date, indicating compatibility with Xcode?"

Let's resolve the root issue which is the lack of documentation surrounding how to know whether it is safe to do any Xcode upgrade - i.e, a compatibility matrix between the Xamarin, and Xcode releases.

Thanks for your time

As of today for Xamarin packages the major version part matches the iOS version they are meant for, so for example xamarin.ios 16.x.x will be meant to be used with the iOS 16 SDK which is part of Xcode 14. But the true rule of thumb is that you will always want to use the latest Xcode release with the latest stable Xamarin provided by your Visual Studio. The only time it does not entirely apply is when Xcode has major releases where we are always a little behind because we get Xcode the same day as everyone else so we need some time to catch up and produce builds with the latest release.

Thanks!

grvingit commented 2 years ago

Thank you for this information, I am really grateful to you that I am up and running again. I installed XCode 14 and the problems started. I have uninstalled 14 and installed 13.4.1 and it's all working fine. Touch wood. I second what Adam-Langley said, this should be clearly documented somewhere, not hidden in a single bug post here. Just a clear list of current recommended versions of all frameworks.

filipkristo commented 2 years ago

With option two I have error "failed to compile the generated registrar code" when I want to deploy to device with development provisioning profile. Anyone else have similar error?

idzikovski commented 2 years ago

With option two I have error "failed to compile the generated registrar code" when I want to deploy to device with development provisioning profile. Anyone else have similar error?

Yes, I do. But I guess it makes sense if your phone is still on iOS 15 as mine. I will update to iOS 16 and try it again

filipkristo commented 2 years ago

With option two I have error "failed to compile the generated registrar code" when I want to deploy to device with development provisioning profile. Anyone else have similar error?

Yes, I do. But I guess it makes sense if your phone is still on iOS 15 as mine. I will update to iOS 16 and try it again

Mine is on iOS 16

emanuelecastelli commented 2 years ago

VS for Mac 17.3.5 with xamarin.ios-15.99.0.464 Xcode 14 iOS 16

I get following build error: MTOUCH: Error MT4109: Failed to compile the generated registrar code. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new (MT4109)

Relevant extract from the build log:

/mtouch-cache/registrar.h:113:9: fatal error: 'CHIP/CHIP.h' file not found
    #import <CHIP/CHIP.h>
            ^~~~~~~~~~~~~
    1 error generated.
banditoth commented 2 years ago

Happening for me aswell.

vanyok1991 commented 2 years ago

Have the same issue

timahrentlov commented 2 years ago

+1

Cheesebaron commented 2 years ago

The +1 and "have same issue" comments are not valuable, use reactions at the opening post.

timahrentlov commented 2 years ago

The +1 and "have same issue" comments are not valuable, use reactions at the opening post.

+1

wispborne commented 2 years ago

The Xamarin quickstart page is not accurate as of XCode 14's release: https://docs.microsoft.com/en-us/xamarin/ios/get-started/hello-ios/hello-ios-quickstart?pivots=macos#requirements

iOS development with Xamarin requires:

  • Latest version of Xcode and iOS SDK installed from the App Store .
tipa commented 2 years ago

Is this for legacy Xamarin only? I did download & install that preview package but still getting an error when trying to compile my .NET6 (non-MAUI) iOS app.

Tool /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.9/Sdk/../tools/mono-aot-cross execution finished (exit code = 134).
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.4.447/targets/Xamarin.Shared.Sdk.targets(1000,3): error : Failed to AOT compile SQLitePCLRaw.provider.sqlite3.dll, the AOT compiler exited with code 134 [/path_to_csproj]

Edit: ignore my comment, my problem is likely related to something else and not the Xcode update

pm64 commented 2 years ago

@dalexsoto, you closed linked https://github.com/xamarin/xamarin-macios/issues/15946 issue based on this issue, depriving OP @Adam-Langley and many in the community of an answer to his important question: "Where is the definitive source of truth, a page that is kept up to date, indicating compatibility with Xcode?".

Unlike this issue, which relates specifically to Xcode 14, @Adam-Langley seeks to answer a more fundamental question that continues to cost many developers countless hours of trial and error with each new Xcode release.

Please re-open https://github.com/xamarin/xamarin-macios/issues/15946, or provide some response here to his important inquiry: At any point in time, how can we determine the latest compatible Xcode version?

ivanicin commented 2 years ago

@pm64 while I have my own notable remarks on Xamarin that I decided to keep silent at the moment, I do think that this was answered.

Microsoft tries to support the latest version of XCode with the latest version of VS. As XCode may break this without any previous notice there is no practical way to inform people. They just try to issue update as soon as possible.

That’s from me to save some time so that people can work now when they should work and not answer the questions.

protokovich commented 2 years ago

17.4.0 Preview 2.0 problem still exists.

XCode 14 & xamarin.ios-15.99.0.464 installed on Mac.

build is ok on simulator. but error on device (iPhone 12 mini iOS 16):

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(235,3): error GE71D2E27: no type or protocol named 'BADownloadManagerDelegate' 4>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(235,3): error MT4109: Failed to compile the generated registrar code. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new

EduardoReisDev commented 2 years ago

I got these two errors when trying to compile a Xamarin project and an iPhone iOS 16.

image

dalexsoto commented 2 years ago

Ah right, Apple removed the Background Assets framework from Xcode 14 and that build does not account for that just yet, the registrar errors will be gone in the next update.

The other way you can workaround this is by setting the linker to Link SDK assemblies only, this should get rid of the registrar errors.

EduardoReisDev commented 2 years ago

@dalexsoto, GREAT!!!! Working on a real iPhone and the emulator, both with iOS 16 ✅

jmmtrimble commented 2 years ago

@dalexsoto Working fine for me too!! Thanks for the solution.

beeradmoore commented 2 years ago
  1. You can download Xcode 13.4.1 from the downloads page in the Apple Developer Portal and continue to use it.

My 2c on that. This tool isn't from MS (and probably isn't endorsed by them in any way) but for those wanting to easily manage, download, and keep multiple versions of Xcode side by side should check out Xcodes.

Minor version increments of Xcode shouldn't break things, but when it does it is a pain to re-download, extract, etc. So it is super handy to keep them side by side and use this tool to select current active version. Then uninstall when you are happy with stability of the latest version.

VS4Mac also jumps to the correct version of Xcode when you mark them as active within the app so you don't have to go touch that config either.

amirvenus commented 2 years ago

One tip for developers:

Ensure Automatic Updates is turned OFF within the App Store settings and NEVER actually update anything on your day to day machine until you can test it out completely on another machine/vm first.

mobilewares commented 2 years ago

FYI: Just in case anyone (like me) went and installed 13.4.1 directly off the Apple site (alongside 14) before they knew about the existence of XCodes (also me) - and XCodes isn't detecting you have 13.4.1 installed (yes, also me too) :

If you launch XCode 13.4.1 (or I think from 14? too) - go into the Preferences > Locations - you can tell it to use the XCode 13.4.1 Command Line tools which is the magic thing needed for VS2022 (on PC or Mac) to launch the 13.4.1 Simulators for debugging. I think XCodes is doing something like this under the hood too.

Fchw_RlacAA9dq3

Note the first time I launched it I had a few popups for security/creation of folders etc, just answered OK to it all and now it's all working smoothly.

XCode14 support would be great though (and I really hope this is being prioritized there) - don't necessarily need specific Xamarin iOS16 SDK support yet - but just want the ability to launch the iPhone14xxx + iOS16 simulators for debugging. I imagine a fair amount of my clients customers went and updated their old devices to iOS16 this week and we really need to support it ASAP.

IngweLand commented 2 years ago

I have a different error when trying to build and install on real device. Error running 'MyApp.iOS': Failed to install application on device qqq: error HE0004: Could not load the framework 'DVTITunesSoftwareServiceFoundation' (path: /Applications/Xcode.app/Contents/SharedFrameworks/DVTITunesSoftwareServiceFoundation.framework/DVTITunesSoftwareServiceFoundation): dlopen(/Applications/Xcode.app/Contents/SharedFrameworks/DVTITunesSoftwareServiceFoundation.framework/DVTITunesSoftwareServiceFoundation, 0x0001): Library not loaded: '@rpath/ContentDelivery.framework/Versions/A/ContentDelivery' // Referenced from: '/Applications/Xcode.app/Contents/SharedFrameworks/DVTITunesSoftwareServiceFoundation.framework/Versions/A/DVTITunesSoftwareServiceFoundation' // Reason: tried: '/usr/lib/swift/ContentDelivery.framework/Versions/A/ContentDelivery' (no such file), '/Library/Frameworks/Xamarin.iOS.framework/Versions/15.12.0.2/lib/mlaunch/mlaunch.app/Contents/MacOS/../Frameworks/ContentDelivery.framework/Versions/A/ContentDelivery' (no such file), '/Applications/Xcode.app/Contents/SharedFram... (4 minutes ago)

itsmuntadhar commented 2 years ago

Having the same issue as @IngweLand

Also, if you're using Venture you can't use Xcode 13 nor its Command Line Tools

it seems I gotta wait for Xcode 14 support to land

berniemills commented 2 years ago

Just going to leave my observation of using Visual Studio for Mac Preview and .Net Maui targeting an iPhone. Was all working fine on xCode 13 then I made the mistake of upgrading to 14. Upgrade took ages and then I was not able to see the simulators as discussed above. I downloaded 13.4.1 as suggested and renamed original Xcode 14 so both could live in the Applications folder.

I then got the simulators back in Visual Studio but when I try and deploy to the iPhone the code downloads then fails to install. The app appears to have a Cloud download icon next to it. Visual Studio sits saying something like .. waiting for the debugger to connect to X's iPhone on port 10000 via USB.

If anyone has any ideas, then do let me know but I get the feeling Xcode 14 download has modified something that I need to undo.

Cheesebaron commented 2 years ago

@berniemills if you start Xcode 13 and go to Preferences > Locations

Then change the Command Line tools back to 13.x.x then you should be good to go again

berniemills commented 2 years ago

Thanks @Cheesebaron but I did try that. Rather annoyingly I had .net Maui deploying to iPhone on mac all working fine a day or so ago with Xcode 13 but it's clearly messed up now. Its failing to launch the debugger on the iPhone. Saying it could not locate device support files. A lot of head scratching ahead I think.

itsmuntadhar commented 2 years ago

@berniemills try downloading support files for your phone from here https://github.com/filsv/iOSDeviceSupport

ivanicin commented 2 years ago

The other way you can workaround this is by setting the linker to Link SDK assemblies only, this should get rid of the registrar errors.

@dalexsoto this doesn't appear to work for me. If the app has a Watch extension this won't work. Obviously maybe your solution will work but this workaround cannot be applied successfully...

berniemills commented 2 years ago

Many thanks @itsmuntadhar

@berniemills try downloading support files for your phone from here https://github.com/filsv/iOSDeviceSupport

Many thanks @itsmuntadhar . This did the trick for me. I had iOS16 support files missing in the Xcode 13.4.1 version and so I downloaded from that link and placed them in the appropriate Xcode.app folder and then I was able to debug the app again.

pasha-o commented 2 years ago

@dalexsoto Getting the following error now with Xcode 14 - ios 16 - I also replaced the ios-device support bits with ios 16 and setting the linker to Link SDK assemblies only, error HE0004: Could not load the framework 'DVTITunesSoftwareServiceFoundation' (path: /Applications/Xcode.app/Contents/SharedFrameworks/DVTITunesSoftwareServiceFoundation.framework/DVTITunesSoftwareServiceFoundation): 0

mcblacksea commented 2 years ago

Xcode version: 14.0 (14A309) iOS version: 16 (20A362) Xamarin.Forms version: 5.0.0.2515 Visual Studio version: Version 17.3.4 Experiencing 2 following issues from 2 different Xamarin forms apps:

  1. Failed to compile the generated registrar code. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
  2. error HE0004: Could not load the framework 'DVTITunesSoftwareServiceFoundation' (path: /Applications/Xcode.app/Contents/SharedFrameworks/DVTITunesSoftwareServiceFoundation.framework/DVTITunesSoftwareServiceFoundation): 0
ivanicin commented 2 years ago

As this is meta bug I guess all related bugs should be linked, I have submitted this one few seconds ago: https://github.com/xamarin/xamarin-macios/issues/15983

nissaba commented 2 years ago

The only time it does not entirely apply is when Xcode has major releases where we are always a little behind because we get Xcode the same day as everyone

as in you have started working on compatibility with Xcode 14 this week when the official version came out, or did you start working on it when the beta came out in June?

ivanicin commented 2 years ago

The only time it does not entirely apply is when Xcode has major releases where we are always a little behind because we get Xcode the same day as everyone

as in you have started working on compatibility with Xcode 14 this week when the official version came out, or did you start working on it when the beta came out in June?

I am the developer and I also have some frustration regarding the current situation. As I have suggested above I think that we should now focus on helping those people to ship this as soon as possible and raise the questions like yours after that. Such questions won't bring any immediate benefit but they will detract people and postpone release for sure.

Also I'll try to provide some helpful information regarding your question.

They did start to work quite a while ago, you can actually track the activity on this site. It is more important question on whether the number of people that worked and time that they dedicated was as usual and as far as I know it wasn't. But as said later on that. It is really not fair to blame people like @chamons that did tremendous work for years that they suddenly became lazy, the problem is obviously somewhere else.

The process is that they need first to make bindings compile and it takes some time. They can just after that fully check Xcode issues and fix them. Clearly Apple adds/changes a lot of things since its release in June so it is not like that they can base their final product on that and have full three months for that.

While most factors for the current state are likely internal, it is also true that Apple has made releases unusually early which further exposed the problems in internal organization...

pasha-o commented 2 years ago

I totally agree with you @ivanicin - you folks work really hard and it's unfair to pass judgment like that. I am very grateful for your work and the team work on this. It's a community and should stay that way. again thank you.

nmoschkin commented 2 years ago

Yeah, unfortunately the Mac upgraded XCode without me having any say in the matter. In fact, it upgraded XCode first, and then asked about upgrading the OS later. I suppose I will just disable all automatic software updates for the Mac, from here on out (assuming my company hasn't altered a security policy to prevent that).

nmoschkin commented 2 years ago

I can confirm that downloading, installing and setting the default tools location to XCode 13.4.1 works.

Apple Downloads <- Scroll down to find XCode 13.4.1

Note for people used to Windows: You don't actually have to do anything to install it except Unzip it. Then run it from wherever it winds up (usually in Downloads), or move it, etc..

berniemills commented 2 years ago

I found that since I was targeting iOS 16 I then had to download the support tools for 16.0 as there were missing from xcode 13.4.1 where upon it also worked for me.

rsbepvb commented 2 years ago

Deleted Xcode 14, downloaded Xcode 13.4.1, installed and now the simulators are back and VS Mac appears to be working ok again.

josejuniorzago commented 2 years ago

I can confirm that downgrade to Xcode 13.4.1 works.

tussock commented 2 years ago

I too can confirm that:

lucapan commented 2 years ago

Same problem here! :(

nschoenberg commented 2 years ago

@dalexsoto Thanks for letting us know, really helpful and much appreciated :) Can you already share a timeframe with us for iOS 16 support?

Thanks in advance

itsmuntadhar commented 2 years ago

Same problem here! :(

@lucapan Have you tried installing Xcode 13.4.1?

If you can't, because you're on Ventura, you can download the preview from here and set your linking option to "Link SDK Assemblies Only" and it should work

lucapan commented 2 years ago

@itsmuntadhar Yes, installing Xcode 13.4.1 solves the problem. Thanks.

jorgeperalta commented 2 years ago

Is there an ETA for this? Downgrading xcode is not an option for me

adam-russell commented 2 years ago

Just to add a quick note in case this is useful for others -- I've been using Xcode 14 with the same build of Xamarin.iOS mentioned in the first comment: xamarin.ios-15.99.0.464.pkg

And I've had builds with it in the App Store for about a week, starting shortly after the first comment here was made. I haven't had any strange crashes or user complaints, though that may be partially because everything happens to work fine for my particular app. I wanted to build with Xcode 14 because I also use app extensions, and I have iOS 16 features in them.

I test on devices using TestFlight mostly. I am not deploying to a physical device to test from my development computer -- I'm uploading to App Store Connect/TestFlight and installing on my test devices with TestFlight.

Also, my linker is set to Link SDK Assemblies Only as @dalexsoto mentions above.

And one more update just in case it matters: I build the IPA to upload to App Store Connect/TestFlight with a Cake script so it's reproducible (because I also build the app extensions freshly with Xcode 14 each time I do an IPA build).

Edit: Updated to be more clear about how I'm testing on physical devices and linker settings. Edit 2: Also updated with how I build the IPA