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.49k stars 515 forks source link

Compiling on iOS17 fails with missing protocol declaration for PKDisbursementAuthorizationControllerDelegate #19113

Closed tussock closed 1 year ago

tussock commented 1 year ago

Steps to Reproduce

  1. VSMac 17.6.4 (build 472)
  2. iOS 17 Device
  3. Have a .Net for iOS project
  4. Select the device (iPad in my case), select debug build.
  5. Build

You get the following errors:

/Users/paul/Dev/MyApp/MyApp.iOS/obj/Debug/ios-arm64/linker-cache/registrar.mm:77444:4: error: cannot find protocol declaration for 'PKDisbursementAuthorizationControllerDelegate'
                    @protocol (PKDisbursementAuthorizationControllerDelegate), /* PassKit.IPKDisbursementAuthorizationControllerDelegate */
                     ^
    5 warnings and 1 error generated.

    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error : clang exited with code 1:
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error : /Users/paul/Dev/MyApp/MyApp.iOS/obj/Debug/ios-arm64/linker-cache/registrar.mm:15868:2: warning: method possibly missing a [super awakeFromNib] call [-Wobjc-missing-super-calls]
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error :         }
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error :         ^
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error : /Users/paul/Dev/MyApp/MyApp.iOS/obj/Debug/ios-arm64/linker-cache/registrar.mm:20560:2: warning: method possibly missing a [super awakeFromNib] call [-Wobjc-missing-super-calls]
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error :         }
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error :         ^
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error : /Users/paul/Dev/MyApp/MyApp.iOS/obj/Debug/ios-arm64/linker-cache/registrar.mm:20639:2: warning: method possibly missing a [super awakeFromNib] call [-Wobjc-missing-super-calls]
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error :         }
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error :         ^
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error : /Users/paul/Dev/MyApp/MyApp.iOS/obj/Debug/ios-arm64/linker-cache/registrar.mm:20787:2: warning: method possibly missing a [super awakeFromNib] call [-Wobjc-missing-super-calls]
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error :         }
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error :         ^
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1139,3): error : /Users/paul/Dev/MyApp/MyApp.iOS/obj/Debug/ios-arm64/linker-cache/registrar.mm:41134:17: warning: auto property synthesis will not synthesize property 'extrapolate' declared in protocol 'CIPhotoEffect' [-Wobjc-protocol-property
Done building target "_CompileNativeExecutable" in project "MyApp.iOS.csproj" -- FAILED.

Note that only the missing declaration for PKDisbursementAuthorizationControllerDelegate is an error, the rest are actually warnings.

Looking elsewhere in the build log, there is the following message:

ILLINK : warning MT4178: The class 'NewsstandKit.NKAssetDownload' will not be registered because the NewsstandKit framework has been removed from the iOS SDK.
ILLINK : warning MT4178: The class 'NewsstandKit.NKLibrary' will not be registered because the NewsstandKit framework has been removed from the iOS SDK.
ILLINK : warning MT4189: The class 'PassKit.PKDisbursementAuthorizationControllerDelegate' will not be registered it has been removed from the iOS SDK.
ILLINK : warning MT4178: The class 'NewsstandKit.NKIssue' will not be registered because the NewsstandKit framework has been removed from the iOS SDK.
ILLINK : warning MT4189: The class 'PassKit.PKDisbursementAuthorizationController' will not be registered it has been removed from the iOS SDK.

Expected Behavior

App compiles against iOS17.

Actual Behavior

Cannot compile to iOS17 device.

Environment

Version information ``` Visual Studio Professional 2022 for Mac Version 17.6.4 (build 472) Installation UUID: af257523-b9e3-45f8-8bb3-2803950ba3f7 Runtime .NET 7.0.3 (64-bit) Architecture: Arm64 Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2 Roslyn (Language Service) 4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa NuGet Version: 6.4.0.117 .NET SDK (Arm64) SDK: /usr/local/share/dotnet/sdk/7.0.308/Sdks SDK Versions: 7.0.308 7.0.307 7.0.306 7.0.304 7.0.302 7.0.203 7.0.202 7.0.414 6.0.413 6.0.412 6.0.410 6.0.408 6.0.407 MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks .NET SDK (x64) SDK Versions: 6.0.414 6.0.413 6.0.412 6.0.410 6.0.408 .NET Runtime (Arm64) Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 8.0.11 7.0.10 7.0.9 7.0.7 7.0.5 7.0.4 6.0.22 6.0.21 6.0.20 6.0.18 6.0.16 6.0.15 .NET Runtime (x64) Runtime: /usr/local/share/dotnet/x64/dotnet Runtime Versions: 6.0.22 6.0.21 6.0.20 6.0.18 6.0.16 Xamarin.Profiler Version: 1.8.0.49 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler Updater Version: 11 Apple Developer Tools Xcode: 15.0 22265 Build: 15A240d Xamarin.Mac Version: 9.3.0.6 Visual Studio Professional Hash: 97731c92c Branch: xcode14.3 Build date: 2023-04-11 22:38:35-0400 Xamarin.iOS Version: 16.4.0.6 Visual Studio Professional Hash: 97731c92c Branch: xcode14.3 Build date: 2023-04-11 22:38:36-0400 Xamarin Designer Version: 17.6.3.9 Hash: 2648399ae8 Branch: remotes/origin/d17-6 Build date: 2023-09-07 02:05:20 UTC Xamarin.Android Version: 13.2.1.2 (Visual Studio Professional) Commit: xamarin-android/d17-5/a8a26c7 Android SDK: /Users/paul/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 13.0 (API level 33) SDK Command-line Tools Version: 7.0 SDK Platform Tools Version: 33.0.3 SDK Build Tools Version: 32.0.0 Build Information: Mono: d9a6e87 Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d Microsoft Build of OpenJDK Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk 11.0.16.1 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL Eclipse Temurin JDK Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk 1.8.0.302 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL Android SDK Manager Version: 17.6.0.50 Hash: a715dca Branch: HEAD Build date: 2023-09-07 02:05:26 UTC Android Device Manager Version: 0.0.0.1309 Hash: 06e3e77 Branch: HEAD Build date: 2023-09-07 02:05:26 UTC Build Information Release ID: 1706040472 Git revision: 0b8c2cb9f01ef14a2b07ff4ea047268c8756fee6 Build date: 2023-09-07 02:03:50+00 Build branch: release-17.6 Build lane: release-17.6 Operating System Mac OS X 14.0.0 Darwin 23.0.0 Darwin Kernel Version 23.0.0 Fri Sep 15 14:43:05 PDT 2023 root:xnu-10002.1.13~1/RELEASE_ARM64_T6020 arm64 ```

Build Logs

Example Project (If Possible)

dalexsoto commented 1 year ago

This is a duplicate of: https://github.com/xamarin/xamarin-macios/issues/18964 you can try the versions and workarounds listed there, there is a new version of Visual Studio coming soon that will contain the fixes.

dtaylorus commented 1 year ago

Xamarin.iOS build 16.4.0.18 referenced by the duplicate bug #18964 does not fix this issue in my debug build. Interestingly, this is not an issue in my release build (my release builds succeed).

dtavlikos commented 1 year ago

Xamarin.iOS build 16.4.0.18 referenced by the duplicate bug #18964 does not fix this issue in my debug build. Interestingly, this is not an issue in my release build (my release builds succeed).

What are your linker settings, please? Maybe there is a difference there.

dtaylorus commented 1 year ago

You're right. The failure was with no linking. I was able to build successfully by linking the SDK only.