HomeiOS Developmentflutter - Unable to construct iOS app with shared_preferences put in

flutter – Unable to construct iOS app with shared_preferences put in


I simply created a brand new flutter undertaking, included the shared_preferences package deal, and a compilation error was introduced.

That is only a verbose paragraph as a result of it appears to be the unlucky case that StackOverflow doesn’t like posts which are principally code.

Terminal output for flutter construct ios:

username@macOS-username app_flutter % flutter construct ios
Constructing com.instance.appFlutter for system (ios-release)...
Robotically signing iOS for system deployment utilizing specified improvement crew in Xcode undertaking: 9485B962Y9
Working pod set up...                                           2,529ms
CocoaPods' output:
↳
      Making ready

    Analyzing dependencies

    Inspecting targets to combine
      Utilizing `ARCHS` setting to construct architectures of goal `Pods-Runner`: (``)
      Utilizing `ARCHS` setting to construct architectures of goal `Pods-RunnerTests`: (``)

    Fetching exterior sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `shared_preferences_foundation` from `.symlinks/plugins/shared_preferences_foundation/darwin`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning native as a result of checking is just carried out in repo
      replace
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning native as a result of checking is just carried out in repo
      replace

    ――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

    ### Command

    ```
    /usr/native/bin/pod set up --verbose
    ```

    ### Report

    * What did you do?

    * What did you anticipate to occur?

    * What occurred as an alternative?


    ### Stack

    ```
       CocoaPods : 1.12.1
            Ruby : ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin22]
        RubyGems : 3.0.3.1
            Host : macOS 13.4.1 ((c))
           Xcode : 14.3.1 (14E300c)
             Git : git model 2.39.2 (Apple Git-143)
    Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib
    Repositories : trunk - CDN - https://cdn.cocoapods.org/
    ```

    ### Plugins

    ```
    cocoapods-deintegrate : 1.0.5
    cocoapods-plugins     : 1.0.0
    cocoapods-search      : 1.0.1
    cocoapods-trunk       : 1.6.0
    cocoapods-try         : 1.2.0
    ```

    ### Podfile

    ```ruby
    # Uncomment this line to outline a worldwide platform to your undertaking
    # platform :ios, '11.0'

    # CocoaPods analytics sends community stats synchronously affecting flutter construct latency.
    ENV['COCOAPODS_DISABLE_STATS'] = 'true'

    undertaking 'Runner', {
      'Debug' => :debug,
      'Profile' => :launch,
      'Launch' => :launch,
    }

    def flutter_root
      generated_xcode_build_settings_path = File.expand_path(File.be part of('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
      until File.exist?(generated_xcode_build_settings_path)
        elevate "#{generated_xcode_build_settings_path} should exist. In the event you're working pod set up manually, be certain that flutter
        pub get is executed first"
      finish

      File.foreach(generated_xcode_build_settings_path) do |line|
        matches = line.match(/FLUTTER_ROOT=(.*)/)
        return matches[1].strip if matches
      finish
      elevate "FLUTTER_ROOT not present in #{generated_xcode_build_settings_path}. Strive deleting Generated.xcconfig, then run
      flutter pub get"
    finish

    require File.expand_path(File.be part of('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

    flutter_ios_podfile_setup

    goal 'Runner' do
      use_frameworks!
      use_modular_headers!

      flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
      goal 'RunnerTests' do
        inherit! :search_paths
      finish
    finish

    post_install do |installer|
      installer.pods_project.targets.every do |goal|
        flutter_additional_ios_build_settings(goal)
      finish
    finish
    ```

    ### Error

    ```
    LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried:
    '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, however is an incompatible structure (have
    'arm64', want 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle'
    (no such file), '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, however is an incompatible
    structure (have 'arm64', want 'x86_64')) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle
    /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
    `require'
    /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
    `require'
    /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi.rb:5:in `rescue in <prime (required)>'
    /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi.rb:2:in `<prime (required)>'
    /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
    `require'
    /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
    `require'
    /Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon.rb:3:in `<prime (required)>'
    /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
    `require'
    /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
    `require'
    /Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<prime (required)>'
    /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
    `require'
    /System/Library/Frameworks/Ruby.framework/Variations/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
    `require'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/cdn_source.rb:440:in
    `download_typhoeus_impl_async'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/cdn_source.rb:372:in
    `download_and_save_with_retries_async'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/cdn_source.rb:284:in `ensure_versions_file_loaded'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/cdn_source.rb:208:in `search'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/supply/mixture.rb:83:in `block in search'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/supply/mixture.rb:83:in `choose'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/supply/mixture.rb:83:in `search'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:416:in `create_set_from_sources'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:385:in `find_cached_set'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:165:in `search_for'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:267:in `every'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:267:in `sort_by'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:267:in `sort_by!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in `block in
    sort_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in
    `with_no_such_dependency_error_handling'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/decision.rb:754:in `push_state_for_requirements'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/decision.rb:744:in `require_nested_dependencies_for'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/decision.rb:727:in `activate_new_spec'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/decision.rb:684:in `attempt_to_activate'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/decision.rb:254:in `process_topmost_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/decision.rb:182:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1082:in `block in
    resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `part'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1080:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:125:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:422:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `part'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:162:in `set up!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/command/set up.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/bin/pod:55:in `<prime (required)>'
    /usr/native/bin/pod:23:in `load'
    /usr/native/bin/pod:23:in `<primary>'
    ```

    ――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

    [!] Oh no, an error occurred.

    Seek for current GitHub points much like yours:
    https://github.com/CocoaPods/CocoaPods/search?q=dlopenpercent28percent2FLibrarypercent2FRubypercent2FGemspercent2F2.6.0percent2Fgemspercent2Fffi-1.15.5percent2Flibpercent2Fffi
    _c.bundlepercent2C+0x0009percent29percent3A+triedpercent3A+%27percent2FLibrarypercent2FRubypercent2FGemspercent2F2.6.0percent2Fgemspercent2Fffi-1.15.5percent2Flibpercent2Fffi_c.bundlepercent27+%28mac
    h-o+filepercent2C+however+is+an+incompatible+structure+%28have+%27arm64percent27percent2C+want+%27x86_64percent27percent29percent29percent2C+%27percent2FSystempercent2FVolumes%
    2FPrebootpercent2FCryptexespercent2FOSpercent2FLibrarypercent2FRubypercent2FGemspercent2F2.6.0percent2Fgemspercent2Fffi-1.15.5percent2Flibpercent2Fffi_c.bundlepercent27+%28no+such+filepercent29
    %2C+%27percent2FLibrarypercent2FRubypercent2FGemspercent2F2.6.0percent2Fgemspercent2Fffi-1.15.5percent2Flibpercent2Fffi_c.bundlepercent27+%28mach-o+filepercent2C+however+is+an+incompati
    ble+structure+%28have+%27arm64percent27percent2C+want+%27x86_64percent27percent29percent29+-+%2FLibrarypercent2FRubypercent2FGemspercent2F2.6.0percent2Fgemspercent2Fffi-1.15.5percent2F
    libpercent2Fffi_c.bundle&kind=Points

    If none exists, create a ticket, with the template displayed above, on:
    https://github.com/CocoaPods/CocoaPods/points/new

    Make sure to first learn the contributing information for particulars on methods to correctly submit a ticket:
    https://github.com/CocoaPods/CocoaPods/blob/grasp/CONTRIBUTING.md

    Remember to anonymize any non-public knowledge!

    In search of associated points on cocoapods/cocoapods...

Error output from CocoaPods:
↳
    Looking for inspections failed: undefined technique `map' for nil:NilClass

    [!] `<XCBuildConfiguration title=`Debug` UUID=`331C8088294A63A400263BE5`>` tried to initialize an object with an
    unknown UUID. `AE0B7B92F70575B8D7E0D07E` for attribute: `base_configuration_reference`. This may be the results of a merge
    and the unknown UUID is being discarded.

    [!] `<XCBuildConfiguration title=`Launch` UUID=`331C8089294A63A400263BE5`>` tried to initialize an object with an
    unknown UUID. `89B67EB44CE7B6631473024E` for attribute: `base_configuration_reference`. This may be the results of a merge
    and the unknown UUID is being discarded.

    [!] `<XCBuildConfiguration title=`Profile` UUID=`331C808A294A63A400263BE5`>` tried to initialize an object with an
    unknown UUID. `640959BDD8F10B91D80A66BE` for attribute: `base_configuration_reference`. This may be the results of a merge
    and the unknown UUID is being discarded.

    [!] `<PBXNativeTarget title=`RunnerTests` UUID=`331C8080294A63A400263BE5`>` tried to initialize an object with an
    unknown UUID. `331C807E294A63A400263BE5` for attribute: `build_phases`. This may be the results of a merge and the unknown
    UUID is being discarded.

    [!] Robotically assigning platform `iOS` with model `11.0` on the right track `Runner` as a result of no platform was specified.
    Please specify a platform for this goal in your Podfile. See
    `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error: To arrange CocoaPods for ARM macOS, run:
  sudo gem uninstall ffi && sudo gem set up ffi -- --enable-libffi-alloc



Error working pod set up
username@macOS-username app_flutter %

Terminal output for flutter physician --verbose:

username@macOS-username initiatives % flutter physician --verbose
[!] Flutter (Channel steady, 3.10.6, on macOS 13.4.1 22F770820d darwin-arm64
    (Rosetta), locale en-US)
    • Flutter model 3.10.6 on channel steady at
      /Customers/username/library/dev.flutter
    ! Warning: `flutter` in your path resolves to
      /Customers/username/Library/dev.flutter/bin/flutter, which isn't inside your
      present Flutter SDK checkout at /Customers/username/library/dev.flutter.
      Contemplate including /Customers/username/library/dev.flutter/bin to the entrance of
      your path.
    ! Warning: `dart` in your path resolves to
      /Customers/username/Library/dev.flutter/bin/dart, which isn't inside your
      present Flutter SDK checkout at /Customers/username/library/dev.flutter.
      Contemplate including /Customers/username/library/dev.flutter/bin to the entrance of
      your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f468f3366c (2 weeks in the past), 2023-07-12 15:19:05 -0700
    • Engine revision cdbeda788a
    • Dart model 3.0.6
    • DevTools model 2.23.1
    • If these have been intentional, you may disregard the above warnings; nevertheless
      it is suggested to make use of "git" on to carry out replace checks and
      upgrades.

[✓] Android toolchain - develop for Android gadgets (Android SDK model
    32.1.0-rc1)
    • Android SDK at /Customers/username/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /Purposes/Android
      Studio.app/Contents/jbr/Contents/Dwelling/bin/java
    • Java model OpenJDK Runtime Setting (construct
      17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Purposes/Xcode.app/Contents/Developer
    • Construct 14E300c
    • CocoaPods model 1.12.1

[✗] Chrome - develop for the online (Can not discover Chrome executable at
    /Purposes/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Can not discover Chrome. Strive setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (model 2022.2)
    • Android Studio at /Purposes/Android Studio.app/Contents
    • Flutter plugin will be put in from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin will be put in from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java model OpenJDK Runtime Setting (construct
      17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (model 1.80.1)
    • VS Code at /Purposes/Visible Studio Code.app/Contents
    • Flutter extension model 3.68.0

[✓] Related system (2 out there)
    • sdk gphone64 arm64 (cell) • emulator-5554 • android-arm64 • Android 12
      (API 31) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64  • macOS 13.4.1
      22F770820d darwin-arm64 (Rosetta)

[✓] Community assets
    • All anticipated community assets can be found.

! Physician discovered points in 2 classes.
username@macOS-username initiatives %

pubspec.yaml:

title: app_flutter
description: A brand new Flutter undertaking.
# The next line prevents the package deal from being by chance printed to
# pub.dev utilizing `flutter pub publish`. That is most well-liked for personal packages.
publish_to: 'none' # Take away this line in case you want to publish to pub.dev

# The next defines the model and construct quantity to your software.
# A model quantity is three numbers separated by dots, like 1.2.43
# adopted by an elective construct quantity separated by a +.
# Each the model and the builder quantity could also be overridden in flutter
# construct by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName whereas build-number used as versionCode.
# Learn extra about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString whereas build-number is used as CFBundleVersion.
# Learn extra about iOS versioning at
# https://developer.apple.com/library/archive/documentation/Normal/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Home windows, build-name is used as the foremost, minor, and patch components
# of the product and file variations whereas build-number is used because the construct suffix.
model: 1.0.0+1

atmosphere:
  sdk: '>=3.0.6 <4.0.0'

# Dependencies specify different packages that your package deal wants with the intention to work.
# To mechanically improve your package deal dependencies to the most recent variations
# think about working `flutter pub improve --major-versions`. Alternatively,
# dependencies will be manually up to date by altering the model numbers under to
# the most recent model out there on pub.dev. To see which dependencies have newer
# variations out there, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter

  shared_preferences: ^2.2.0


  # The next provides the Cupertino Icons font to your software.
  # Use with the CupertinoIcons class for iOS fashion icons.
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package deal under accommodates a set of advisable lints to
  # encourage good coding practices. The lint set supplied by the package deal is
  # activated within the `analysis_options.yaml` file situated on the root of your
  # package deal. See that file for details about deactivating particular lint
  # guidelines and activating further ones.
  flutter_lints: ^2.0.0

# For info on the generic Dart a part of this file, see the
# following web page: https://dart.dev/instruments/pub/pubspec

# The next part is particular to Flutter packages.
flutter:

  # The next line ensures that the Materials Icons font is
  # included together with your software, so to use the icons in
  # the fabric Icons class.
  uses-material-design: true

  # So as to add belongings to your software, add an belongings part, like this:
  # belongings:
  #   - photos/a_dot_burr.jpeg
  #   - photos/a_dot_ham.jpeg

  # A picture asset can consult with a number of resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For particulars concerning including belongings from package deal dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # So as to add {custom} fonts to your software, add a fonts part right here,
  # on this "flutter" part. Every entry on this checklist ought to have a
  # "household" key with the font household title, and a "fonts" key with a
  # checklist giving the asset and different descriptors for the font. For
  # instance:
  # fonts:
  #   - household: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Common.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         fashion: italic
  #   - household: Trajan Professional
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For particulars concerning fonts from package deal dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments