flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Flutter 2.0.2 iOS compilation error

Open SebAubin opened this issue 3 years ago • 11 comments

🐛 Bug Report

Hi, we have some issues compiling on iOS since we've made the update to Flutter 2.

Expected behavior

Normal build

Reproduction steps

We have this issue in the logs: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_FlutterError", referenced from: objc-class-ref in permission_handler(PermissionHandlerPlugin.o) "_FlutterMethodNotImplemented", referenced from: -[PermissionHandlerPlugin handleMethodCall:result:] in permission_handler(PermissionHandlerPlugin.o) "_OBJC_CLASS_$_FlutterMethodChannel", referenced from: objc-class-ref in HttpRequests.o objc-class-ref in permission_handler(PermissionHandlerPlugin.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Configuration

We are on Xcode 12.4, Dart 2.12.1 and Flutter 2.0.2 Version: 5.0.1+2

Platform:

  • [X] :iphone: iOS
  • [ ] :robot: Android

SebAubin avatar Mar 17 '21 13:03 SebAubin

Could you try with version 5.1.0+2 of the permission_handler?

mvanbeusekom avatar Mar 17 '21 13:03 mvanbeusekom

Unfortunately the error is still present

SebAubin avatar Mar 17 '21 13:03 SebAubin

Did you already migrate your project to support null safety (what I really want to know is, if your application is configured to run on sdk 2.12.0 or higher)?

mvanbeusekom avatar Mar 17 '21 13:03 mvanbeusekom

We did not migrate to null safety yet. If so, it would be the version 6.0.0 or higher right?

SebAubin avatar Mar 17 '21 13:03 SebAubin

Yes correct. But technically you can migrate without updating the permission_handler, which could lead to bugs so not recommended.

mvanbeusekom avatar Mar 17 '21 13:03 mvanbeusekom

Ok, we dit not migrate to null safety anyway

SebAubin avatar Mar 17 '21 14:03 SebAubin

The thing is that I cannot reproduce the issue. I used the following steps:

  • Create a new Flutter App using: flutter create ph_issue_488;
  • Open the new project in your favourite IDE (in my case I used Visual Studio Code);
  • Add the permission_handler: ^5.0.1+2 to your pubspec.yaml;
  • Make sure the dependencies are downloaded (most IDE's do this automatically): flutter pub get;
  • Build the App for iOS: flutter build ios --no-codesign.

This works without any problems for me. Something you might be able to try is to clean the build: flutter clean.

flutter doctor -v
[✓] Flutter (Channel stable, 2.0.2, on macOS 11.2.3 20D91 darwin-x64, locale en-GB)
    • Flutter version 2.0.2 at /Users/maurits/fvm/versions/stable
    • Framework revision 8962f6dc68 (6 days ago), 2021-03-11 13:22:20 -0800
    • Engine revision 5d8bf811b3
    • Dart version 2.12.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/maurits/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/maurits/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_242-release-1644-b3-6222593)
    • 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-6222593)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 54.0.3
    • Dart plugin version 203.7759

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

[✓] Connected device (3 available)
    • Nexus 5X (mobile)                      • 01043361c1b19568          • android-arm64  • Android 8.1.0 (API 27)
    • Maurits van Beusekom’s iPhone (mobile) • 00008101-000D543E1A40001E • ios            • iOS 14.4
    • Chrome (web)                           • chrome                    • web-javascript • Google Chrome 89.0.4389.90

• No issues found!

mvanbeusekom avatar Mar 17 '21 14:03 mvanbeusekom

Thanks for your answers. It's not working but I think it's more of a Flutter problem than PermissionHandler.

SebAubin avatar Mar 17 '21 17:03 SebAubin

It seems to be a bug between this lib and Flutter 2.x.x because when I remove the dependencies, it works correctly.

SebAubin avatar Mar 30 '21 12:03 SebAubin

Have you updated Xcode to 12.4? After updating a lot of packages in my flutter project, permission_handler included, I was getting a framework error for permission_handler. After a lot of troubleshooting, pod installs, etc. updating Xcode fixed the problem.

mhstoller avatar Apr 07 '21 15:04 mhstoller

we have same build error with latest flutter 2.2.1 and xcode 12.5

fullflash avatar Jun 01 '21 21:06 fullflash

Closing this issue as there has not been any activity for over two years.

If you are encountering this issue, feel free to open a new issue.

JeroenWeener avatar Jul 11 '23 13:07 JeroenWeener