iPhone 上的 Xamarin Deploy 无法与 Xcode 14 一起使用

Ste*_*rle 17 xcode xamarin xamarin.forms

无法在物理设备上部署任何 Xamarin iOS 应用程序。也许你们中的某个人已经遇到了同样的问题并且知道解决方法?

Xcode:版本 14.0 (14A309) Visual Studio for Mac:17.3.4(内部版本 4)

尝试调试时出现以下错误。我已经尝试多次清理项目并删除 bin 和 obj 文件夹:

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.
Run Code Online (Sandbox Code Playgroud)

当尝试部署发布版本时,我得到:

/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.
Run Code Online (Sandbox Code Playgroud)

小智 9

将命令行工具降级到 13.4 对我有所帮助。

在 xCode (仍然是 14) -> 首选项 -> 位置 -> 命令行工具中,选择版本 13.4 而不是 14。重新启动工具,它再次工作...

在此输入图像描述

希望它也适合你!