[FIXED] Xamarin Deploy on iPhone not working with Xcode 14

Issue

It’s not possible to deploy any Xamarin iOS app on a physical device. Maybe someone of you already had the same issues and knows about a work around?

Xcode: Version 14.0 (14A309)
Visual Studio for Mac: 17.3.4 (build 4)

When trying to Debug I get following error. I’ve already tried multiple times to clean the project and delete bin and obj folders:

Target _CopyAppConfigFile:
  Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.
Target CopyFilesToOutputDirectory:
    Xamarin.iOS -> .../Xamarin/Xamarin.iOS/bin/iPhone/Debug/Xamarin.iOS.exe
Target _CopyResourcesToBundle:
  Skipping target "_CopyResourcesToBundle" because all output files are up-to-date with respect to the input files.
Target _WriteAppManifest:
  Skipping target "_WriteAppManifest" because all output files are up-to-date with respect to the input files.
Target _CompileToNative:
    /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Xamarin/Xamarin.iOS/obj/iPhone/Debug/device-builds/iphone14.2-16.0/response-file.rsp 
    Xamarin.iOS 15.12.0.2 (d17-3: 87f98a75e) using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.0.sdk
    Compilation failed with code 1, command:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Wno-receiver-forward-class -Wno-objc-missing-super-calls -Wno-unguarded-availability-new -stdlib=libc++ -gdwarf-2 -std=c++14 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/15.12.0.2/SDKs/MonoTouch.iphoneos.sdk/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.0.sdk -Qunused-arguments -miphoneos-version-min=9.0 -arch arm64 -c -o /Xamarin/Xamarin.iOS/obj/iPhone/Debug/device-builds/iphone14.2-16.0/mtouch-cache/arm64/registrar.o -x objective-c++ -D DEBUG /Xamarin/Xamarin.iOS/obj/iPhone/Debug/device-builds/iphone14.2-16.0/mtouch-cache/registrar.m
    In file included from /Xamarin/Xamarin.iOS/obj/iPhone/Debug/device-builds/iphone14.2-16.0/mtouch-cache/registrar.m:3:
    /Xamarin/Xamarin.iOS/obj/iPhone/Debug/device-builds/iphone14.2-16.0/mtouch-cache/registrar.h:112:9: fatal error: 'CHIP/CHIP.h' file not found
    #import <CHIP/CHIP.h>
            ^~~~~~~~~~~~~
    1 error generated.
    MTOUCH : error MT4109: Failed to compile the generated registrar code. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
Done building target "_CompileToNative" in project "Xamarin.iOS.csproj" -- FAILED.

When trying to Deploy a release build I get:

/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch -sdkroot "/Applications/Xcode.app/Contents/Developer" --installdev ".../Xamarin.iOS/bin/iPhone/Release/Xamarin.iOS.app" --device ios "--devname=iPhone 13 Pro" --install-progress
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/SharedFrameworks/DVTITunesSoftwareServiceFoundation.framework/Versions/A/Frameworks/ContentDelivery.framework/Versions/A/ContentDelivery' (no such file), '/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/SharedFrameworks/DVTITunesSoftwareServiceFoundation.framework/Versions/A/Frameworks/ContentDelivery.framework/Versions/A/ContentDelivery' (no such file), '/System/Library/Frameworks/ContentDelivery.framework/Versions/A/ContentDelivery' (no such file)
        

Application could not be uploaded to the device.

Solution

Downgrading the Command Line Tools to 13.4 helped me.

In xCode (still 14) -> Preferences -> Location -> Command Line Tools, select version 13.4 instead of 14. Restart tools and it worked again…

enter image description here

Hope it works for you too!

Answered By – Anastasia

Answer Checked By – Willingham (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published