OneSignal / OneSignal-DotNet-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your .NET app with OneSignal. https://onesignal.com
MIT License
16 stars 5 forks source link

[Bug]: NotificationServiceExtension fails to compile with CLang++ Error #64

Closed bnoffer closed 11 months ago

bnoffer commented 1 year ago

What happened?

Implemented the NotificationServiceExtension according to the updated documenation and during compilation of the Extension I received the following exception:

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error : clang++ exited with code 1:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error : Undefined symbols for architecture arm64:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :   "_OBJC_CLASS_$_OSInAppMessage", referenced from:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :       objc-class-ref in registrar.o
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :   "_OBJC_CLASS_$_OSInAppMessageClickEvent", referenced from:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :       objc-class-ref in registrar.o
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :   "_OBJC_CLASS_$_OSInAppMessageClickResult", referenced from:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :       objc-class-ref in registrar.o
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :   "_OBJC_CLASS_$_OSInAppMessageDidDismissEvent", referenced from:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :       objc-class-ref in registrar.o
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :   "_OBJC_CLASS_$_OSInAppMessageDidDisplayEvent", referenced from:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :       objc-class-ref in registrar.o
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :   "_OBJC_CLASS_$_OSInAppMessageTag", referenced from:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :       objc-class-ref in registrar.o
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :   "_OBJC_CLASS_$_OSInAppMessageWillDismissEvent", referenced from:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :       objc-class-ref in registrar.o
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :   "_OBJC_CLASS_$_OSInAppMessageWillDisplayEvent", referenced from:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error :       objc-class-ref in registrar.o
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error : ld: symbol(s) not found for architecture arm64
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7090/targets/Xamarin.Shared.Sdk.targets(1274,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation)

Steps to reproduce?

1. Create a iOS Notification Service Extension project for .NET MAUI
2. Add the v.5.0.0 Nuget package
3. Add the code as per Documenation

What did you expect to happen?

The project should compile fine, as it does with v4.3.3.

Relevant log output

Visual Studio Community 2022 for Mac
Version 17.6.3 (build 421)
Installation UUID: 07646305-debf-4b1e-8757-afe66c02a6da

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.307/Sdks
SDK Versions:
    7.0.307
    6.0.413
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    7.0.10
    6.0.21

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Versions:
    3.1.32
    3.1.31
    3.1.30
    3.1.29
    3.1.28
    3.1.27

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode: 14.3 21812
Build: 14E222b

Xamarin.Mac
Version: 9.3.0.6 Visual Studio Community
Hash: 97731c92c
Branch: xcode14.3
Build date: 2023-04-11 22:38:35-0400

Xamarin.iOS
Version: 16.4.0.6 Visual Studio Community
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-08-02 19:06:42 UTC

Xamarin.Android
Version: 13.2.1.2 (Visual Studio Community)
Commit: xamarin-android/d17-5/a8a26c7
Android SDK: /Users/ban/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        12.1 (API level 32)
        12.0 (API level 31)
        11.0 (API level 30)
        9.0  (API level 28)
        13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 34.0.3
SDK Build Tools Version: 33.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-08-02 19:06:47 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2023-08-02 19:06:47 UTC

Build Information
Release ID: 1706030421
Git revision: c90350679f1b9295edc584519320b13d06489853
Build date: 2023-08-02 19:05:00+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 13.5.0
Darwin 22.6.0 Darwin Kernel Version 22.6.0
    Wed Jul  5 22:22:05 PDT 2023
    root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64

Code of Conduct

sivehc commented 1 year ago

I'm running into the same issue. I have a .net 7 application and after installing the OneSignal Dotnet SDK and implementing the Extension assembly, I'm getting the following error when building the solution:

Error clang++ exited with code 1: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_OSInAppMessage", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_OSInAppMessageClickEvent", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_OSInAppMessageClickResult", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_OSInAppMessageDidDismissEvent", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_OSInAppMessageDidDisplayEvent", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_OSInAppMessageTag", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_OSInAppMessageWillDismissEvent", referenced from: objc-class-ref in registrar.o "_OBJC_CLASS_$_OSInAppMessageWillDisplayEvent", referenced from: objc-class-ref in registrar.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7098\targets\Xamarin.Shared.Sdk.targets 1274

Screenshot 2023-09-19 111810

efhayati commented 1 year ago

Same error here: clang++ exited with code 1: MAUI .NET 7.0 app

pontusbjornfot commented 1 year ago

Same issue here. Installed according to the documentation, also using .NET 7. Is this a known issue and when is it expected to be resolved?

If not, does anyone have an idea of what might have gone wrong? I've gone through everything multiple times and it all seems to be in order. Appreciate the response, I'm in the final stages of my project but I'm a bit stuck now.

chrisdeweese commented 1 year ago

Also encountering this issue. I am developing a MAUI .NET 7.0 project.

This issue happens when attempting to build to iOS 17 with Xcode 15 installed, it's not a problem when building Android 13.

lealanderson commented 12 months ago

Same error here: clang++ exited with code 1:

.NET MAUI 7 build to iOS 16.4 with Xcode 14.3.1

emawby commented 11 months ago

This was fixed in version 5.0.2