Closed Sabriel1984 closed 8 months ago
@Sabriel1984 maybe you missed this part. First, you just need to include FirebaseMessaging library to your iOS app from Xcode. I used Swift Package Manager for adding dependencies in iOS. Here's how to do it in XCode. File -> Add Package Dependencies -> Entering " https://github.com/firebase/firebase-ios-sdk" in url field -> Add Package Button. And make sure Firebase Messaging is also chosen
Thanks for help, I'm fresh in KMM so it wasn't obvious for me that I also need to add iOS firebase sdk and which dependency solution I should use. I encounter some XCode issues but finally compilation on iOS in Xcode succeed.
I followed instruction from here: https://proandroiddev.com/how-to-implement-push-notification-in-kotlin-multiplatform-5006ff20f76c on fresh Kotlin Multiplatform Project generated from Android Studio (without Cocoa Pods). Android works perfectly, but I still fighting with iOS compilation using 3 different IDE's (AS, Xcode and Fleet) and have no idea what is wrong. I paste build logs:
....
User defaults from command line: IDECustomDerivedDataLocation = /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line: COCOAPODS_SKIP_KOTLIN_BUILD = YES OBJROOT = /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED = YES SYMROOT = /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Products TEST_AFTER_BUILD = NO
--- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:iOS Simulator, id:B511D847-FB0A-410C-8B2C-231EFEA17861, OS:17.2, name:iPhone 15 } { platform:iOS Simulator, id:B511D847-FB0A-410C-8B2C-231EFEA17861, OS:17.2, name:iPhone 15 } Prepare packages
...
Ld /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Products/Debug-iphonesimulator/iosApp.app/iosApp normal (in target 'iosApp' from project 'iosApp') cd /Users/krajchel/Development/AndroidStudio/KMPNotifierTest/iosApp /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target arm64-apple-ios16.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.2.sdk -O0 -L/Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator -L/Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Products/Debug-iphonesimulator -F/Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator -F/Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Products/Debug-iphonesimulator -F/Users/krajchel/Development/AndroidStudio/KMPNotifierTest/iosApp/../shared/build/xcode-frameworks/Debug/iphonesimulator17.2 -filelist /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/arm64/iosApp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/arm64/iosApp_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/arm64/iosApp.swiftmodule -framework shared -Xlinker -sectcreate -Xlinker TEXT -Xlinker entitlements -Xlinker /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex/iosApp.build/Debug-iphonesimulator/iosApp.build/iosApp.app-Simulated.xcent -Xlinker -sectcreate -Xlinker TEXT -Xlinker ents_der -Xlinker /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex/iosApp.build/Debug-iphonesimulator/iosApp.build/iosApp.app-Simulated.xcent.der -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Intermediates.noindex/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/arm64/iosApp_dependency_info.dat -o /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Products/Debug-iphonesimulator/iosApp.app/iosApp
ld: Undefined symbols: The following build commands failed: _OBJCCLASS$_FIRMessaging, referenced from: in shared2 Ld /Users/krajchel/Library/Caches/JetBrains/Fleet/backend/KMPNotifierTest.ep2jv5j26q040f498ad9/DerivedData/iosApp-ddgrzpipzoxfiieeifejojlabfys/Build/Products/Debug-iphonesimulator/iosApp.app/iosApp normal (in target 'iosApp' from project 'iosApp') clang: error: linker command failed with exit code 1 (use -v to see invocation) (1 failure)