OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
606 stars 204 forks source link

[Bug]: Swift Compiler Error (Xcode) #853

Closed eng-mohamedfarouk closed 3 months ago

eng-mohamedfarouk commented 3 months ago

What happened?

I have error message after update XCode to the latest Version 15.3 (15E204a)

Swift Compiler Error (Xcode): Failed to build module 'OneSignalFramework'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)'). Please select a toolchain which matches the SDK.

Steps to reproduce?

build failed with xcode

What did you expect to happen?

change the Swift version of the your project

OneSignal Flutter SDK version

onesignal_flutter: ^5.1.1

Which platform(s) are affected?

Relevant log output

Swift Compiler Error (Xcode): 'OSInAppMessages' is not a member type of class 'OneSignalCore.OneSignalCore'
/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface:39:24

Swift Compiler Error (Xcode): 'OSLocation' is not a member type of class 'OneSignalCore.OneSignalCore'
/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface:68:24

Swift Compiler Error (Xcode): 'OSInAppMessages' is not a member type of class 'OneSignalCore.OneSignalCore'
/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface:23:49

Swift Compiler Error (Xcode): 'OSDebug' is not a member type of class 'OneSignalCore.OneSignalCore'
/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface:26:41

Swift Compiler Error (Xcode): 'OSLocation' is not a member type of class 'OneSignalCore.OneSignalCore'
/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface:29:44

Swift Compiler Error (Xcode): Failed to build module 'OneSignalFramework'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)'). Please select a toolchain which matches the SDK.

Code of Conduct

Constans commented 3 months ago

Got the same issue:

Swift Compiler Error (Xcode): Failed to build module 'OneSignalFramework'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)'). Please select a toolchain which matches the SDK.

Reverted back to 5.1.0 for now.

  onesignal_flutter: 5.1.0

The previous version will run perfectly.

SuhailFoodCloud commented 3 months ago

Hi, I am getting the same issue. The build is done on AppCenter -

Using - onesignal_flutter: ^5.0.2

Xcode build done.                                       
Failed to build iOS app
Swift Compiler Error (Xcode): 'OSDebug' is not a member type of class 'OneSignalCore.OneSignalCore'
/Users/runner/work/1/s/src/build/ios/Release-uat-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/arm64-apple-ios.private.swiftinterface:36:24

Swift Compiler Error (Xcode): 'OSInAppMessages' is not a member type of class 'OneSignalCore.OneSignalCore'
/Users/runner/work/1/s/src/build/ios/Release-uat-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/arm64-apple-ios.private.swiftinterface:39:24

Swift Compiler Error (Xcode): 'OSLocation' is not a member type of class 'OneSignalCore.OneSignalCore'
/Users/runner/work/1/s/src/build/ios/Release-uat-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/arm64-apple-ios.private.swiftinterface:68:24

Swift Compiler Error (Xcode): 'OSInAppMessages' is not a member type of class 'OneSignalCore.OneSignalCore'
/Users/runner/work/1/s/src/build/ios/Release-uat-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/arm64-apple-ios.private.swiftinterface:23:49

Swift Compiler Error (Xcode): 'OSDebug' is not a member type of class 'OneSignalCore.OneSignalCore'
/Users/runner/work/1/s/src/build/ios/Release-uat-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/arm64-apple-ios.private.swiftinterface:26:41

Swift Compiler Error (Xcode): 'OSLocation' is not a member type of class 'OneSignalCore.OneSignalCore'
/Users/runner/work/1/s/src/build/ios/Release-uat-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/Modules/OneSignalFramework.swiftmodule/arm64-apple-ios.private.swiftinterface:29:44

Swift Compiler Error (Xcode): Failed to build module 'OneSignalFramework'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)'). Please select a toolchain which matches the SDK.
/Users/runner/work/1/s/src/ios/OneSignalNotificationServiceExtension/NotificationService.swift:2:7

Encountered error while building for device.
nan-li commented 3 months ago

Hi everyone, thank you for reporting. There was an issue with this release, and we just shipped an updated version in Release 5.1.2!

ArielFarias commented 3 months ago

I'm having trouble using the release 5.1.2, it is building and installing, but when I try to open the app it crashes, this is a small part of the log:

------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: 6D87FC2A-4FBA-4CFA-9C20-0BABC4A2D90A
CrashReporter Key:   40DB30E5-03CE-4829-73B2-107D8C629E92
Hardware Model:      MacBookAir10,1
Process:             Runner [15474]
Path:                /Users/USER/Library/Developer/CoreSimulator/Devices/6318FD20-F6C5-4632-B423-735BBC1E37CE/data/Containers/Bundle/Application/FB498205-8B30-478B-8108-76496D2C8C63/Runner.app/Runner
Identifier:          br.com.ephealth.science
Version:             1.4.7 (47)
Code Type:           X86-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [80163]
Coalition:           com.apple.CoreSimulator.SimDevice.6318FD20-F6C5-4632-B423-735BBC1E37CE [19646]
Responsible Process: SimulatorTrampoline [635]

Date/Time:           2024-03-07 18:45:19.7825 -0300
Launch Time:         2024-03-07 18:45:19.2866 -0300
OS Version:          macOS 13.3.1 (22E772610a)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: DYLD 4 Symbol missing
Symbol not found: _OBJC_CLASS_$_OneSignalCoreImpl
Referenced from: <A137B5A4-C85B-3204-BE37-8FF35CF89B8B> /Users/USER/Library/Developer/CoreSimulator/Devices/6318FD20-F6C5-4632-B423-735BBC1E37CE/data/Containers/Bundle/Application/FB498205-8B30-478B-8108-76496D2C8C63/Runner.app/Frameworks/OneSignalFramework.framework/OneSignalFramework
Expected in:     <87F3DFDE-A65F-31B5-94CD-BCE9405B398A> /Users/USER/Library/Developer/CoreSimulator/Devices/6318FD20-F6C5-4632-B423-735BBC1E37CE/data/Containers/Bundle/Application/FB498205-8B30-478B-8108-76496D2C8C63/Runner.app/Frameworks/OneSignalCore.framework/OneSignalCore
(terminated at launch; ignore backtrace)

Triggered by Thread:  0

Running on emulator.

In order to FIX IT I had to force using version 5.1.0 on pubspec.yaml:

onesignal_flutter: 5.1.0