Hi, I'm having issues when I'm trying to Archive my project (preparing for App Store submit). Xcode throws a linker error. When I Build the project, it shows as a warning and the build is OK. But when I try to Archive, it becomes an error and I can't make an Archive.
Message
Ld /Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension normal arm64
cd /Users/rgb/Repositories/cadsys_member_app_flutter/ios
export IPHONEOS_DEPLOYMENT_TARGET=12.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -L/Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos -L/Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/onesignal -L/Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/shared_preferences -L/Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/url_launcher -F/Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos -F/Users/rgb/Repositories/cadsys_member_app_flutter/ios/Pods/../.symlinks/flutter/ios-release -F/Users/rgb/Repositories/cadsys_member_app_flutter/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework -filelist /Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/OneSignalNotificationServiceExtension.build/Objects-normal/arm64/OneSignalNotificationServiceExtension.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/../../Frameworks -miphoneos-version-min=12.1 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/OneSignalNotificationServiceExtension.build/Objects-normal/arm64/OneSignalNotificationServiceExtension_lto.o -fobjc-arc -fobjc-link-runtime -fapplication-extension -ObjC -lonesignal -lshared_preferences -lurl_launcher -framework Flutter -framework OneSignal -framework SystemConfiguration -framework UIKit -framework UserNotifications -ObjC -framework OneSignal -framework SystemConfiguration -framework UIKit -framework UserNotifications -e _NSExtensionMain -lPods-OneSignalNotificationServiceExtension -Xlinker -dependency_info -Xlinker /Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/OneSignalNotificationServiceExtension.build/Objects-normal/arm64/OneSignalNotificationServiceExtension_dependency_info.dat -o /Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension
Short version
ld: library not found for -lonesignal
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea about this?
Ok some more information:
ld: warning: directory not found for option '-L/Users/rgb/Repositories/cadsys_member_app_flutter/build/ios/Release-iphoneos/onesignal'
ld: library not found for -lonesignal
Seems the directory is not created when I run FLUTTER BUILD IOS? Attaching an image of the release directory:

Ok, I have a fix. It seems that this is related to the framework issues with Flutter/Flutter.h that many people are experiencing. For some reason files become aliases. I noticed that in the OneSignalSDK folder, all of the files had been converted to aliases. What I had to do, was copy the actual files from Versions/A into the Framework and overwrite the aliases. Then I was able to build the Archive.
Screenshot below of AFTER I overwrote the files. Forgot to take a "before" picture. But, basically all of the files and folder under OneSignal.Framework was aliases (just like the folder named Current).

Is this a Flutter issue? Or something with your Framework?
We believe this is an issue with the Flutter Cocoapods integration that can sometimes screw up the symlinks for our framework. The aliases/symlinks are the standard way to build iOS frameworks as there鈥檚 no point in duplicating files.
Any solution to this?
Have found that if you run this in Terminal to delete the DerivedData folder, thing seem to work in Xcode in oder to build an Archive:
rm -rf ~/Library/Developer/Xcode/DerivedData/
BUT, now Visual Studio Code is acting up instead. Linker error again, and it is ALWAYS OneSignal that is the issue:
/Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/OneSignalNotificationServiceExten
sion.build/OneSignalNotificationServiceExtension.appex-Simulated.xcent -lPods-OneSignalNotificationServiceExtension -Xlinker -dependency_info -Xlinker
/Users/rgb/Library/Developer/Xcode/DerivedData/Runner-bfsbdjyhevoadldwunsvgeguxclc/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/OneSignalNotificationServiceExten
sion.build/Objects-normal/x86_64/OneSignalNotificationServiceExtension_dependency_info.dat -o
/Users/rgb/Repositories/xyz_member_app_flutter/build/ios/Debug-iphonesimulator/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension
ld: warning: directory not found for option '-L/Users/rgb/Repositories/xyz_member_app_flutter/build/ios/Debug-iphonesimulator/onesignal'
ld: warning: directory not found for option '-L/Users/rgb/Repositories/xyz_member_app_flutter/build/ios/Debug-iphonesimulator/shared_preferences'
ld: warning: directory not found for option '-L/Users/rgb/Repositories/xyz_member_app_flutter/build/ios/Debug-iphonesimulator/url_launcher'
ld: library not found for -lonesignal
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I didn't have to update my web app in 100 places to migrate to Firebase< I would have done so long ago. OneSignal is literally my only issue while building my app in Flutter.
@Nightsd01 is there any change that this will be looked at?
Please see #42 for more info on this
Most helpful comment
Any solution to this?