giandifra / simple_share

A Flutter plugin for share image, video or file
MIT License
18 stars 15 forks source link

Problem building in IOS #7

Closed felpsio closed 5 years ago

felpsio commented 5 years ago

Not sure if is the same problem than the other issue. But, I tried to use and I'm facing this problem when building the project:

Launching lib/main.dart on iPhone XR in debug mode... CocoaPods' output: ↳ Preparing Analyzing dependencies Inspecting targets to integrate Using ARCHS setting to build architectures of target Pods-Runner: (``) Finding Podfile changes A simple_share

lakexyde commented 5 years ago

Hello @felipecesar42 You might need to add the following to your Podfile

platform :ios, '10.0'

And then:

target 'Runner' do
  use_frameworks! #<----- add this
...

And then:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['SWIFT_VERSION'] = '3.2' #<-------  Add this
...

Hope it helps.

felpsio commented 5 years ago

thanks @lakexyde . I solved the issue the way you recommended :). It would be great to have this on the documentation :)

giandifra commented 5 years ago

add to documentation thanks

glennmichaelmejias commented 5 years ago

I followed your way. But still get this error.

[!] Unable to determine Swift version for the following pods:

- `simple_share` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least
one of the targets that integrate this pod.
glennmichaelmejias commented 5 years ago

here is my pod file


platform :ios, '10.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

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['SWIFT_VERSION'] = '4.1'
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['SWIFT_VERSION'] = '3.2'
    end
  end
end```
felpsio commented 5 years ago

your podfile looks good to me. Have you tried flutter clean?

Anyway... I'm using https://pub.dartlang.org/packages/share_extend now