Unact / yandex_mapkit

Flutter implementation of YandexMapkit
MIT License
132 stars 151 forks source link

Version 1.1.0 ios compilation issue #128

Closed softkot closed 2 years ago

softkot commented 2 years ago

Версия 1.1.0 не собирается на IOS получаются ошибки

    /Users/cta/flutter/.pub-cache/hosted/pub.dartlang.org/yandex_mapkit-1.1.0/ios/Classes/YandexMapController.swift:118:35: error: variable used within its own initial value
          let isZoomGesturesEnabled = isZoomGesturesEnabled()
                                      ^
    /Users/cta/flutter/.pub-cache/hosted/pub.dartlang.org/yandex_mapkit-1.1.0/ios/Classes/YandexMapController.swift:142:35: error: variable used within its own initial value
          let isTiltGesturesEnabled = isTiltGesturesEnabled()
cream-cheeze commented 2 years ago

Очень странно... Ошибка понятна, но неправдоподобна - пишет, что якобы в константу пытаются записать её собственное значение, но это не так - константа isZoomGesturesEnabled присваивает значение результата выполнения одноимённой функции, а не самой себя.

Собрал только что эту версию с примером у себя - работает без проблем.

@DCrow не догадываешься, в чём может быть причина?

DCrow commented 2 years ago

@cream-cheeze У меня тоже приложение пример собирается без ошибок.

Вполне возможно, что какая-нибудь проблема с версией swift, а может и каких-то флагов.

@softkot Собирается ли у вас тестовое приложение? Также просьба приложить flutter doctor --verbose

softkot commented 2 years ago
$ flutter doctor --verbose
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.15.7 19H524 darwin-x64, locale ru-RU)
    • Flutter version 2.2.3 at /Users/cta/flutter
    • Framework revision f4abaa0735 (5 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/cta/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • 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-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 57.0.5
    • Dart plugin version 211.7233

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114

Пример так же не компилируется.

% flutter build ios --no-codesign
Running "flutter pub get" in example...                             3,0s
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.unact.yandexMapkitExample1 for device (ios-release)...
Running pod install...                                              8,0s
Running Xcode build...                                                  
Xcode build done.                                           15,6s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    Command CompileSwift failed with a nonzero exit code
    /Users/cta/Projects/yandex_mapkit/ios/Classes/YandexMapController.swift:118:35: error: variable used within its own initial value
          let isZoomGesturesEnabled = isZoomGesturesEnabled()
                                      ^
    /Users/cta/Projects/yandex_mapkit/ios/Classes/YandexMapController.swift:142:35: error: variable used within its own initial value
          let isTiltGesturesEnabled = isTiltGesturesEnabled()
                                      ^
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging
    enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner' from project 'Runner')
    warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging
    enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner' from project 'Runner')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
cream-cheeze commented 2 years ago

Короче, по-ходу, так в Swift'е не стоит делать - здесь обсуждается. Почему у нас собирается - вопрос...

В общем, сделаю фикс - переименую константу.

cream-cheeze commented 2 years ago

Сделал PR - должно помочь.

DCrow commented 2 years ago

Это все из-за того что XCode 12.5 поддерживает swift 5.4, где добавили такую возможность

Но да, лучше поддерживать и другие версии от 5.0

cream-cheeze commented 2 years ago

Понятно..

DCrow commented 2 years ago

Выпустил новую версию 1.1.1, где эта проблема исправлена.

softkot commented 2 years ago

Спасибо быстрые парни :)