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

Issue with iOS / System MacBook Air M1 with MacOS 12.0.1

Open Konst80 opened this issue 3 years ago • 4 comments

🐛 Bug Report

The build process for iOS 15.0 simulator and also for a real device cannot be completed successfully.

Any help is very much appreciated

Output:

Launching lib/main.dart on iPhone 13 in debug mode...
Xcode build done.                                            2,0s
Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:

    { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    { platform:iOS Simulator, id:33473E86-7670-4419-A9AA-040B217D4E19, OS:15.0, name:iPad (9th generation) }
    { platform:iOS Simulator, id:B10A193F-EB9E-421A-B14F-184865777A6D, OS:15.0, name:iPad Air (4th generation) }
    { platform:iOS Simulator, id:F03D8A8F-1706-4C38-929B-904CC1FF97F7, OS:15.0, name:iPad Pro (9.7-inch) }
    { platform:iOS Simulator, id:D053DE11-D147-4DDE-9CE4-D098A52E4381, OS:15.0, name:iPad Pro (11-inch) (3rd generation) }
    { platform:iOS Simulator, id:34BB7735-0433-4619-9A5F-F502B30BDC63, OS:15.0, name:iPad Pro (12.9-inch) (5th generation) }
    { platform:iOS Simulator, id:FF8F9D92-40DF-41C9-82D0-EDE3F9ED909C, OS:15.0, name:iPad mini (6th generation) }
    { platform:iOS Simulator, id:31557EC9-9E27-40F7-9A1B-B2F665E66A1B, OS:15.0, name:iPhone 8 }
    { platform:iOS Simulator, id:E801D4DC-1132-4C01-8D5C-81D18BEE262F, OS:15.0, name:iPhone 8 Plus }
    { platform:iOS Simulator, id:662B83F4-3635-4A7F-8552-F5BAB13A225F, OS:15.0, name:iPhone 11 }
    { platform:iOS Simulator, id:75DF7CA5-577F-4506-8DF6-CE48E50074D7, OS:15.0, name:iPhone 11 }
    { platform:iOS Simulator, id:799A9BBC-82A6-4FAF-8764-F4208FB40FD8, OS:15.0, name:iPhone 11 Pro }
    { platform:iOS Simulator, id:D11E1DA1-49BB-4440-AF10-096E88E158FC, OS:15.0, name:iPhone 11 Pro Max }
    { platform:iOS Simulator, id:D73116C2-0EE8-45DA-9286-2C825EE48D1D, OS:15.0, name:iPhone 12 }
    { platform:iOS Simulator, id:53B04B09-53DB-4474-A5A0-2CE96E4AB5CF, OS:15.0, name:iPhone 12 Pro }
    { platform:iOS Simulator, id:4D0AAD37-413A-407F-8652-FE8D2CF0F08C, OS:15.0, name:iPhone 12 Pro Max }
    { platform:iOS Simulator, id:48067D82-FF4A-40E0-9DBE-6070A35BDA89, OS:15.0, name:iPhone 12 mini }
    { platform:iOS Simulator, id:3C2F3B73-148F-4FB6-B099-405C1BAE112A, OS:15.0, name:iPhone 13 }
    { platform:iOS Simulator, id:8861EEE0-25A5-4A26-9602-78EB24A1AEF9, OS:15.0, name:iPhone 13 Pro }
    { platform:iOS Simulator, id:E715CAA6-EEB7-4AB7-ACEC-D36548980A91, OS:15.0, name:iPhone 13 Pro Max }
    { platform:iOS Simulator, id:70F42753-676A-42C1-A81A-ECE84B9BEC08, OS:15.0, name:iPhone 13 mini }
    { platform:iOS Simulator, id:FBA37F13-B31A-432F-9678-63B1BAE2E6F7, OS:15.0, name:iPhone SE (2nd generation) }
    { platform:iOS Simulator, id:28657C6C-7251-4BC4-B93F-E71DE0F3529D, OS:15.0, name:iPod touch (7th generation) }
    { platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00008103-001808292E8A001E }
    { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    ** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/xxx/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.13/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/xxx/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.13/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal error: Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)

Expected behavior

-> The build process should successfully be completed.

Reproduction steps

-> The original example project was used as code without any modifications: https://pub.dev/packages/permission_handler/example -> Setup for iOS was done within Podfile and Info.plist as described: https://pub.dev/packages/permission_handler

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',

        ## dart: PermissionGroup.microphone
         'PERMISSION_MICROPHONE=1',

      ]

    end
  end
end

Configuration

System MacBook Air M1 with MacOS 12.0.1

✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale de-DE)
    • Flutter version 2.5.3 at /Users/konstantin/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (7 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc4)
    • Android SDK at /Users/konstantin/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0-rc4
    • Java binary at: /Users/konstantin/.Trash/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.1, Build version 13A1030d
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 2020.3)
    • 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.10+0-b96-7281165)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Users/konstantin/.Trash/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.10+0-b96-7249189)

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

[✓] Connected device (3 available)
    • iPhone 13 (mobile) •  • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • macOS (desktop)    • macos                                • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 96.0.4664.55

Platform:

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

Konst80 avatar Dec 04 '21 21:12 Konst80

I am getting same issue? Any solution?

maliaydemir avatar Dec 06 '21 08:12 maliaydemir

same issue

Ahmed-Ezzeldin avatar Dec 09 '21 14:12 Ahmed-Ezzeldin

I solved with creating new project. I copied all files and folders expect ios folder. Here is my hero on stackoverflow: link

maliaydemir avatar Dec 09 '21 17:12 maliaydemir

I have found a solution, by the following approach:

  1. Ensuring that 'pod install --verbose' does not report any errors.

  2. Modified the podfile according to this description link. Here is an example:

post_install do |installer|
  installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
        target.build_configurations.each do |config|
            # You can enable the permissions needed here. For example to enable camera
            # permission, just remove the `#` character in front so it looks like this:
            #
            # ## dart: PermissionGroup.camera
            # 'PERMISSION_CAMERA=1'
            #
            # When enabled here, corresponding metadata should be added to info.plist
            config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
                '$(inherited)',

                ## dart: PermissionGroup.calendar
                # 'PERMISSION_EVENTS=1',

                ## dart: PermissionGroup.reminders
                # 'PERMISSION_REMINDERS=1',

                ## dart: PermissionGroup.contacts
                # 'PERMISSION_CONTACTS=1',

                ## dart: PermissionGroup.camera
                # 'PERMISSION_CAMERA=1',

                ## dart: PermissionGroup.microphone
                # 'PERMISSION_MICROPHONE=1',

                ## dart: PermissionGroup.speech
                # 'PERMISSION_SPEECH_RECOGNIZER=1',

                ## dart: PermissionGroup.photos
                # 'PERMISSION_PHOTOS=1',

                ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
                # 'PERMISSION_LOCATION=1',

                ## dart: PermissionGroup.notification
                # 'PERMISSION_NOTIFICATIONS=1',

                ## dart: PermissionGroup.mediaLibrary
                # 'PERMISSION_MEDIA_LIBRARY=1',

                ## dart: PermissionGroup.sensors
                # 'PERMISSION_SENSORS=1',

                ## dart: PermissionGroup.bluetooth
                # 'PERMISSION_BLUETOOTH=1',

                ## dart: PermissionGroup.appTrackingTransparency
                # 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',

                ## dart: PermissionGroup.criticalAlerts
                # 'PERMISSION_CRITICAL_ALERTS=1'
            ]
        end
    end
end

Konst80 avatar Dec 15 '21 11:12 Konst80

I am closing this issue as it has not had any activity in the last 1.5 years. If you are experiencing the same or a similar issue, feel free to open a new issue, linking this issue for reference.

JeroenWeener avatar Aug 30 '23 15:08 JeroenWeener