amplitude/Amplitude-Flutter

Deprecated API usage in iOS

pal opened this issue · 1 comments

pal commented

Expected Behavior

Build should complete without any errors from Amplitude.

Current Behavior

[01:00:37]: ▸ Generating 'Amplitude.framework.dSYM'
[01:00:37]: ▸ Touching Amplitude.framework (in target 'Amplitude' from project 'Pods')
[01:00:37]: ▸ Processing amplitude_flutter-Info.plist
[01:00:37]: ▸ Copying amplitude_flutter-umbrella.h
[01:00:37]: ▸ Copying AmplitudeFlutterPlugin.h
[01:00:37]: ▸ Compiling SwiftAmplitudeFlutterPlugin.swift
[01:00:38]: ▸ ⚠️  /Users/pal/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/SwiftAmplitudeFlutterPlugin.swift:127:64: 'logRevenue(_:quantity:price:)' is deprecated: Use `logRevenueV2` and `AMPRevenue` instead
[01:00:38]: ▸                     Amplitude.instance(withName: instanceName).logRevenue(productIdentifier,
[01:00:38]: ▸                                                                ^
[01:00:38]: ▸ ⚠️  /Users/pal/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/SwiftAmplitudeFlutterPlugin.swift:134:64: 'logRevenue' is deprecated: Use `logRevenueV2` and `AMPRevenue` instead
[01:00:38]: ▸                     Amplitude.instance(withName: instanceName).logRevenue(NSNumber(value: amount))
[01:00:38]: ▸                                                                ^
[01:00:38]: ▸ Compiling SwiftAmplitudeFlutterPlugin.swift
[01:00:38]: ▸ ⚠️  /Users/pal/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/SwiftAmplitudeFlutterPlugin.swift:127:64: 'logRevenue(_:quantity:price:)' is deprecated: Use `logRevenueV2` and `AMPRevenue` instead
[01:00:38]: ▸                     Amplitude.instance(withName: instanceName).logRevenue(productIdentifier,
[01:00:38]: ▸                                                                ^
[01:00:38]: ▸ ⚠️  /Users/pal/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/SwiftAmplitudeFlutterPlugin.swift:134:64: 'logRevenue' is deprecated: Use `logRevenueV2` and `AMPRevenue` instead
[01:00:38]: ▸                     Amplitude.instance(withName: instanceName).logRevenue(NSNumber(value: amount))
[01:00:38]: ▸                                                                ^

Possible Solution

Stop using deprecated API and use the recommended APIs intead.

Steps to Reproduce

  1. Depend on amplitude_flutter: ^3.7.0
  2. Build and watch logs, I saw this while using fastlane: bundle exec fastlane beta

Environment

[✓] Flutter (Channel master, 2.10.0-1.0.pre.344, on macOS 12.2 21D49 darwin-arm, locale en-SE)
    • Flutter version 2.10.0-1.0.pre.344 at /Users/pal/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6f079010b4 (5 hours ago), 2022-01-31 14:32:18 -0500
    • Engine revision 48ae905cb1
    • Dart version 2.17.0 (build 2.17.0-67.0.dev)
    • DevTools version 2.10.0-dev.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/pal/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2021.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 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.32.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 12.2 21D49 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 97.0.4692.99

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@pal Thanks for pointing this out. We will replace the deprecated method in Flutter.