Error in pod install (using swift)
Description:
Error in pod install when add onesignal to packages, just on ios, android works fine!
Environment
tested with 1.0.0 and 1.0.1 pub and follow setup guide
Steps to Reproduce Issue:
- Install the OneSignal Flutter SDK using pub into your project
- compile and get the error
Anything else:
[!] The 'Pods-Runner' target has transitive dependencies that include static binaries: (/Users/XXXX/Documents/FlutterProjects/XXXXX/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework)
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:81:in `block (2 levels) in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `block in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:70:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:70:in `verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:36:in `validate!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:415:in `validate_targets'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:118:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
@lubritto Can you post your iOS project's Podfile? I am not able to reproduce this issue, did you add use_frameworks!?
When i create a project in flutter including swift as platform channel, the podfile already comes with use_frameworks!
My podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
i have the same problem!
I also ran into this issue. The default Podfile that is installed with the command flutter create -i swift project_name comes with !use_frameworks included. The exact steps are as follows:
- Run command
flutter create -i swift project_name - Run
flutter build ios(Confirming that a complete vanilla project builds successfully) - Go into the pubspec file and add the onesignal dependency
onesignal: ^1.0.0 - Run
flutter packages get(assuming the IDE hasn't done it automatically) - Run
flutter build ios(With onesignal, the build process now errors out.)
That final command shows the following:
Building ■■■■■■■■■■■■■■■■■■■■■ for device (ios-release)... Automatically signing iOS for device deployment using specified development team in Xcode project: ■■■■■■■■■■■ Running pod install... 0.9s CocoaPods' output: ↳ Preparing
Analyzing dependencies Inspecting targets to integrate Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``) Finding Podfile changes M Flutter - onesignal Fetching external sources -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios-release` -> Fetching podspec for `onesignal` from `.symlinks/plugins/onesignal/ios` Resolving dependencies of `Podfile` Comparing resolved specification to the sandbox manifest - Flutter - OneSignal - onesignal Downloading dependencies -> Using Flutter (1.0.0) -> Using OneSignal (2.8.5) -> Using onesignal (1.0.1) - Running pre install hooks [!] The 'Pods-Runner' target has transitive dependencies that include static binaries: (/■■■■■■■■■■■■■■■■■■■■■■/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework) /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:81:in `block (2 levels) in verify_no_static_framework_transitive_dependencies' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `block in verify_no_static_framework_transitive_dependencies' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:70:in `each' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:70:in `verify_no_static_framework_transitive_dependencies' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:36:in `validate!' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:415:in `validate_targets' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:118:in `install!' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run' /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>' /usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod:22:in `load' /usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod:22:in `<main>'Error running pod install
This can also be seen by running pod install directly within the ios directory:
Analyzing dependencies Fetching podspec for
Flutterfrom.symlinks/flutter/ios-releaseFetching podspec foronesignalfrom.symlinks/plugins/onesignal/iosDownloading dependencies Using Flutter (1.0.0) Using OneSignal (2.8.5) Using onesignal (1.0.1) [!] The 'Pods-Runner' target has transitive dependencies that include static binaries: (/■■■■■■■■■■■■■■■■■■■■■■/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework)
Commenting out the !use_frameworks seems to fix the issue, but if the project depends on any other plugins that are implemented as frameworks, then that's not an acceptable solution.
I am definitely able to reproduce this issue - I am investigating now. Thanks for all the details!
Any update? I'm stuck on this as I can't remove use_frameworks because I have other firebase stuff
I had to remove all firebase dependencies so I can comment out !use_frameworks to make this work.
Same situation in here.. i can't remove use_frameworks
Same problem here. I use other plugins that require use_frameworks!
Also experience the problem.
Hey @nightsd01, any updates on this?
Apologies for the delay. The problem is that, for historical reasons (iOS 7 support), our SDK's framework is a static framework, not a dynamic framework.
I've created a dynamic version of our iOS SDK that will fix this issue, but I'm deciding how to implement this dependency structure. We do not want to just switch our default cocoapod to being a dynamic framework since this can cause a lot of issues for people using our native SDK and other wrapper SDK's. We are considering having a separate pod spec for the dynamic framework (ie. maybe pod "OneSignal-Dynamic").
I will update this issue shortly with a workaround, and I expect to have a fully fleshed-out fix within the next few days. Thanks for your patience!
Why does the OneSignal-Flutter module need to provide iOS 7 support? Flutter itself is only slated to support iOS 8+.
@andrewackerman great question - for Flutter we don’t provide iOS 7 support of course. But our Flutter SDK is basically just a wrapper on top of our native iOS SDK.
And our native iOS SDK is used in a lot of stuff beyond flutter - it gets used by native iOS apps, react native, Xamarin, etc.
At this point we wouldn’t mind deprecating iOS 7 support. I’m just explaining why - historically speaking, we went with a static framework. So many apps use our iOS framework at this point that we are cautious to make such a change.
In any case, I’ll be updating the flutter SDK to use a dynamic iOS framework instead.
Is the issue only with swift projects?
This issue is for swift projects or projects with swift plugins
@Nightsd01 How close are you to releasing the dynamic framework?
Sorry for the delay on this everyone but we finally have a dynamic framework! This will work in Swift projects. I will be creating a new release for certain tomorrow.
The only concern is that our dynamic framework is also a fat framework. This is fine with static frameworks as only the ARM specific code will get linked when you upload to the App Store. But with dynamic frameworks specifically, Apple will not allow you to upload an app with a fat dynamic framework.
So in addition to updating our SDK tomorrow, I will be adding a new step in our setup guide to add a short little build script to your iOS project (strictly speaking it's only necessary when you actually archive and upload to the App Store).
Thanks for your patience everyone and I apologize it took so long to get this fixed!
If you want to use it right now, you can modify our onesignal.podspec file and change pod 'OneSignal' to pod 'OneSignalDynamic'
There are some other issues with our SDK that I intend to fix as well in tomorrow's release
@Nightsd01 the new version will be released today ? I tried to change OneSinal to OneSignalDymaic, but another error appeared