Baseflow / flutter-permission-handler

Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
https://baseflow.com
MIT License
2.04k stars 850 forks source link

Can not build iOS app with autofill extension (ld: warning: Could not find or use auto-linked framework 'Flutter' Undefined symbols for architecture arm64:) #834

Closed DziugasMolis closed 2 years ago

DziugasMolis commented 2 years ago

🐛 Bug Report

So I needed storage permission and used your package. Everything worked great on android but on iOS I can not build my app. Tried searching ways to solve it, did not find any. Only way to solve it is to use another package for permission but this one looks perfect for my case, maybe I will help others too. Every time I tried to build my app I get this error: If I removed your package app builds just fine.

ld: warning: Could not find or use auto-linked framework 'Flutter'
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FlutterError", referenced from:
      objc-class-ref in permission_handler_apple(PermissionHandlerPlugin.o)
  "_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
      objc-class-ref in permission_handler_apple(PermissionHandlerPlugin.o)
  "_FlutterMethodNotImplemented", referenced from:
      -[PermissionHandlerPlugin handleMethodCall:result:] in permission_handler_apple(PermissionHandlerPlugin.o)
ld: symbol(s) not found for architecture arm64
Screenshot 2022-04-15 at 13 27 13

Expected behavior

App builds

Reproduction steps

Have Flutter iOS app with autofill extension

Configuration

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.0.1 21A559 darwin-x64, locale
    en-LT)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] IntelliJ IDEA Community Edition (version 2021.2.2)
[✓] VS Code (version 1.66.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

my pubspec.yaml


environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  flutter_localizations:
    sdk: flutter
  flutter_svg: ^1.0.3
  material_design_icons_flutter: ^5.0.6595
  path_provider: ^2.0.1
  package_info: ^2.0.0

  in_app_purchase: ^3.0.2

  xxxxxxxx_sdk:
    path: ./sdk

  # hvstore:
  #   path: ../hvstore
  hive: ^2.0.0
  hive_flutter: ^1.0.0

  get_it: ^7.2.0
  crypto: ^3.0.0
  shared_preferences: ^2.0.3
  flutter_secure_storage: ^5.0.2
  connectivity: ^3.0.2
  device_info: ^2.0.0
  zxcvbn:
    path: ./zxcvbn

  version: ^2.0.0
  flutter_tags:
    path: ./flutter_tags

  flutter_bloc: ^8.0.1
  provider: ^6.0.2
  rxdart: ^0.27.3
  equatable: ^2.0.0

  local_auth: ^1.1.0
  cached_network_image: ^3.2.0
  public_suffix: ^3.0.0

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2

  flutter_web_browser: ^0.17.0
  pdf: ^3.7.3
  permission_handler: ^9.2.0
  open_file: ^3.2.1

  # For launching apps
  url_launcher: ^6.0.2
  android_intent: ^2.0.0

dev_dependencies:
  # flutter_driver:
  #   sdk: flutter
  test: ^1.6.0
  # flutter_test:
  #   sdk: flutter

  hive_generator: ^1.0.0
  build_runner: ^2.1.8

Version: 9.2.0

Platform:

DziugasMolis commented 2 years ago

okay, so after digging through various forums I found a solution... In my autofill extension in Other Linker Flags I removed -framework ""permission_handler_apple"" and added it to my Runner app, also from autofill extension I removed $(inherited) and left everything else as is. Hope this thread will help to solve same issue in the future.

Not sure if it helped but ran those commands:

rm -rf ~/Library/Developer/Xcode/DerivedData/*\n
 rm ios/Podfile ios/Podfile.lock pubspec.lock
 flutter run