pszklarska / beacon_broadcast

A Flutter plugin for turning your device into a beacon.
https://pub.dartlang.org/packages/beacon_broadcast/
MIT License
81 stars 33 forks source link

Issue with building for iOS #2

Closed patrickdronk closed 5 years ago

patrickdronk commented 5 years ago

Hi šŸ‘‹

First of all thank you for the effort taken into this library! I have an use-case in wanted to try it out immediately, sadly I have errors in a clean flutter project, running on my iOS device. I think it has to do with the project setup it's using objective-c instead of swift.

Running pod install...
CocoaPods' output:
ā†³
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Fetching external sources
    -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
    -> Fetching podspec for `beacon_broadcast` from `.symlinks/plugins/beacon_broadcast/ios`

    Resolving dependencies of `Podfile`

    Comparing resolved specification to the sandbox manifest
      A Flutter
      A beacon_broadcast

    Downloading dependencies

    -> Installing Flutter (1.0.0)

    -> Installing beacon_broadcast (0.0.1)
      - Running pre install hooks
    [!] Unable to determine Swift version for the following pods:

    - `beacon_broadcast` 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.

    /usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer/xcode/target_validator.rb:115:in `verify_swift_pods_swift_version'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:459:in `validate_targets'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:138:in `install!'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command/install.rb:48:in `run'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command.rb:52:in `run'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `load'
    /usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `<main>'

Error output from CocoaPods:
ā†³

    [!] `<PBXGroup UUID=`97C146E51CF9000F007C117D`>` attempted to initialize an object with an unknown UUID. `CF3B75C9A7D2FA2A4C99F110` for attribute: `children`. This can be the result of a merge and  the unknown UUID is being discarded.

    [!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Finished with error: Error running pod install
pszklarska commented 5 years ago

Hi Patrick! Thanks for reporting the issue, I'll look into that šŸ‘

pszklarska commented 5 years ago

Hi Patrick, I investigated this and your problem is, as you suggested, caused by using Swift plugin in your Objective-C project. There's a Flutter issue for this: https://github.com/flutter/flutter/issues/16049. But unfortunately it's still unresolved šŸ˜Ÿ

For now it can't be fixed on my side, however according to this SO answer you can change your ios/Podfile to make it work:

target 'Runner' do
  use_frameworks!  # required by simple_permission
  ...
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'  # required by simple_permission
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

I've checked this and it worked for me.