loup-v / beacons

Flutter beacons plugin for Android and iOS.
Apache License 2.0
78 stars 53 forks source link

Trouble integrating Swift plugin #1

Closed AndrewPetrovics closed 6 years ago

AndrewPetrovics commented 6 years ago

Couldn't integrate plugin into my Flutter project. I believe the problem has to do with the note mentioned in the readme.

After adding the package to .yaml...

First error:

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift...

Then, I added the following to Podfile...

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.2'
    end
  end
end

Next error:

/Users/andrew/dev/Pointz/Frontend/ios/Pods/Headers/Public/beacons/BeaconsPlugin.h:1:9: error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>

Then, I added the following to Podfile...

use_frameworks!

and

pre_install do |installer|
 Pod::Installer::Xcode::TargetValidator.send(:define_method,:verify_no_static_framework_transitive_dependencies) {}
end

and

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.headers_build_phase.files.each do |file|
      file.settings = { 'ATTRIBUTES' => ['Public'] }
    end
  end
end

and then, I deleted Podfile.lock, /ios/Pods and ran flutter clean and got the following error:

Warning: Multiple build commands for output file /Users/andrew/dev/Pointz/Frontend/build/ios/Debug-iphoneos/BoringSSL/openssl.framework/Headers/x509.h
    Warning: Multiple build commands for output file /Users/andrew/dev/Pointz/Frontend/build/ios/Debug-iphoneos/BoringSSL/openssl.framework/Headers/x509_vfy.h
    Warning: Multiple build commands for output file /Users/andrew/dev/Pointz/Frontend/build/ios/Debug-iphoneos/BoringSSL/openssl.framework/Headers/x509v3.h
    In file included from /Users/andrew/dev/Pointz/Frontend/ios/Pods/GoogleToolboxForMac/Foundation/GTMLogger.m:19:
    /Users/andrew/dev/Pointz/Frontend/ios/Pods/GoogleToolboxForMac/Foundation/GTMLogger.h:53:9: fatal error: 'GTMDefines.h' file not found
    #import "GTMDefines.h"
            ^~~~~~~~~~~~~~
    1 error generated.
Could not build the precompiled application for the device.

I've tried a bunch of other stuff as well, but no dice.

Here's my flutter doctor -v output:

[✓] Flutter (Channel master, v0.4.5-pre.55, on Mac OS X 10.12.6 16G1212, locale en-US)
    • Flutter version 0.4.5-pre.55 at /Users/Andrew/dev/flutter
    • Framework revision be6501a91c (9 hours ago), 2018-05-21 11:54:38 +0100
    • Engine revision 1179c38a42
    • Dart version 2.0.0-dev.55.0.flutter-43635d3372

[✓] iOS toolchain - develop for iOS devices (Xcode 9.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.1, Build version 9B55
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.0

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio 2.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
lukaspili commented 6 years ago

I could not reproduce the issue, both on latest master and beta channels.

I followed the instruction from https://github.com/flutter/flutter/issues/16049#issuecomment-382629492

flutter create --template=app test
cd test
flutter run => fails

In ios/Podfile, I added:

rm ios/Podfile.lock
flutter run => success

What's your Cocoapods version? From my understanding, this workaround works on 1.5+

pod --version
AndrewPetrovics commented 6 years ago

Took some finagling, but got it working.

Testing functionality now...

asoseil commented 6 years ago

doesn't work for me:

*** First throw call stack: ( 0 CoreFoundation 0x000000010ce131e6 __exceptionPreprocess + 294 1 libobjc.A.dylib 0x000000010c4a8031 objc_exception_throw + 48 2 CoreFoundation 0x000000010ce18472 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000010bf4b652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4 CoreLocation 0x000000011cb54c85 CLClientRetrieveData + 26207 5 beacons 0x000000010bdd9cee _T07beacons14LocationClientCACycfc + 1262 6 beacons 0x000000010bdd9d43 _T07beacons14LocationClientCACycfcTo + 19 7 beacons 0x000000010bdd97b0 _T07beacons14LocationClient<…>

theronic commented 6 years ago

@AndrewPetrovics how did you get it working? I have a similar issue on a non-Flutter project.

tmello01 commented 5 years ago

Having the same issue on the newest version of flutter and of beacons. Was there ever a fix for this?