andre-paraense / launchdarkly_flutter

A LaunchDarkly Flutter SDK
GNU Lesser General Public License v3.0
4 stars 5 forks source link

Is the Legacy Build Environment required? (For iOS) #18

Closed matthewrice345 closed 4 years ago

matthewrice345 commented 4 years ago

Describe the bug launchdarkly_flutter creates a build failure on iOS when using the new build system. The issues is related to LDTimer.swift and EnvironmentReporter.swift. These two classes are using older swift code which results in the following errors:

/Users/mrice/Development/Nav/nav_mobile/ios/Pods/LaunchDarkly/LaunchDarkly/LaunchDarkly/Service Objects/EnvironmentReporter.swift:115:30: error: 'didEnterBackgroundNotification' has been renamed to 'NSNotification.Name.UIApplicationDidEnterBackground' return UIApplication.didEnterBackgroundNotification ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSNotification.Name.UIApplicationDidEnterBackground UIKit.UIApplication:25:22: note: 'didEnterBackgroundNotification' was introduced in Swift 4.2 public class let didEnterBackgroundNotification: NSNotification.Name ^ /Users/mrice/Development/Nav/nav_mobile/ios/Pods/LaunchDarkly/LaunchDarkly/LaunchDarkly/Service Objects/EnvironmentReporter.swift:118:30: error: 'willEnterForegroundNotification' has been renamed to 'NSNotification.Name.UIApplicationWillEnterForeground' return UIApplication.willEnterForegroundNotification ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSNotification.Name.UIApplicationWillEnterForeground UIKit.UIApplication:28:22: note: 'willEnterForegroundNotification' was introduced in Swift 4.2 public class let willEnterForegroundNotification: NSNotification.Name ^ /Users/mrice/Development/Nav/nav_mobile/ios/Pods/LaunchDarkly/LaunchDarkly/LaunchDarkly/Service Objects/LDTimer.swift:38:55: error: 'default' has been renamed to 'RunLoopMode.defaultRunLoopMode' RunLoop.main.add(timer, forMode: RunLoop.Mode.default) ^~~~~~~ RunLoopMode.defaultRunLoopMode Foundation.RunLoop.Mode:4:23: note: 'default' was introduced in Swift 4.2 public static letdefault: RunLoopMode

I am unsure if this is because I am using the newer build system or a newer version of swift. Either way it the awesome repo you have created won't work.

To Reproduce Steps to reproduce the behavior:

  1. Add the repo to a project.
  2. Try to build on an iOS device.
  3. The build fails as described above.

Expected behavior The build is successful.

Screenshots N/A

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Here is my flutter doctor -v output:

[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en) • Flutter version 1.17.1 at /Users/mrice/Development/flutter • Framework revision f7a6a7906b (2 weeks ago), 2020-05-12 18:39:00 -0700 • Engine revision 6bc433c6b6 • Dart version 2.8.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/mrice/Library/Android/sdk • Platform android-29, build-tools 29.0.2 • ANDROID_HOME = /Users/mrice/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.2.1, Build version 11B500 • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] IntelliJ IDEA Community Edition (version 2019.2.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 40.2.4 • Dart plugin version 192.7359

[!] VS Code (version 1.40.1) • VS Code at /Applications/Visual Studio Code.app/Contents ✗ Flutter extension not installed; install from https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available) • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.0 (API 24) (emulator) • Matthews iPhone • 168d06cb9e829868b8f5b733fa59872799076ac3 • ios • iOS 13.4.1

andre-paraense commented 4 years ago

Thanks for your issue and detailed description, @matthewrice345 . We will be looking into this very soon.

andre-paraense commented 4 years ago

Hi, @matthewrice345 . I was unable to reproduce this bug running the example app in the repository. My first hypothesis was that Flutter 1.17 had introduced changes to had broken the plugin, but this is not the case. Like you said, it may have to do with changes in the version of Swift or the build system.

Before going any further, can you confirm if the example app in the repository works in your environment? Like I said, it worked for me. Please follow the README there so you provide your LaunchDarkly keys properly and test if they work in Android and iOS.

Here is more information about my environment from flutter doctor:

$ flutter doctor -v
[✓] Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.5 19F96, locale en-GB)
    • Flutter version 1.17.3 at /Users/andre/Projetos/flutter
    • Framework revision b041144f83 (16 hours ago), 2020-06-04 09:26:11 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/andre/Library/Android/sdk
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/andre/Library/Android
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.1

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (1 available)            
    • iPhone 11 Pro Max • 62BCCC4B-3192-48E4-BAAA-9B56D6060721 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)
matthewrice345 commented 4 years ago

Hey @andre-paraense I think I managed to get things working. Turns out I was targeting Swift 4.3 and I believe that was the source of the issue. I don't think anything in this library was the root cause with 4.3 but the iOS dependency on LD. Thanks for the support and effort! config.build_settings['SWIFT_VERSION'] = '4.3'

andre-paraense commented 4 years ago

Hey @matthewrice345 , good to know you managed to get things working! I will close this issue for now, let me know if you catch anything wrong or have any problems! :)