【问题标题】:After adding shared_preferences, I cannot build iOS simulator of Flutter添加shared_preferences后,我无法构建Flutter的iOS模拟器
【发布时间】:2019-03-22 17:50:15
【问题描述】:

在我将 shared_preferences 添加到 pubspec.yaml 后,iOS sumulator 从未成功构建。

我试过了

  • 扑干净
  • 升级 cocoapods
  • pod 安装
  • pod 卸载
  • 吊舱解体

但他们都没有解决这个问题。

版本

~/i/fissus ❯❯❯ flutter --version                                                                                                                    master ✱
Flutter 0.10.1-pre.45 • channel master • https://github.com/flutter/flutter.git
Framework • revision bdc3dda5f2 (2 days ago) • 2018-10-15 15:03:02 -0700
Engine • revision 32f417db0d
Tools • Dart 2.1.0-dev.7.1.flutter-b99bcfd309
~/i/fissus ❯❯❯ dart --version                                                                                                                       master ✱
Dart VM version: 2.0.0 (Fri Aug 3 10:53:23 2018 +0200) on "macos_x64"
~/i/fissus ❯❯❯ pod --version                                                                                                                        master ✱
1.5.3

pubspec.yaml

name: fproject
description: A new Flutter project.

version: 1.0.0+1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  rxdart: ^0.19.0 
  cupertino_icons: ^0.1.2
  font_awesome_flutter: ^8.1.0
  http: ^0.12.0
  shared_preferences: ^0.4.3

dev_dependencies:
  flutter_test:
    sdk: flutter


flutter:
  fonts:
    - family: Noto
      fonts:
        - asset: fonts/NotoSansCJKjp-Regular.otf
        - asset: fonts/NotoSansCJKjp-Bold.otf

错误信息

Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
ERROR: Invalid version /Users/ryu.ishikawa/issus/fissus/ios/./Podfile.lock
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
Could not build the application for the simulator.
Error launching application on iPhone XS Max.
Exited (sigterm)

备忘录

我已阅读此问题,但无法解决此问题。

https://github.com/flutter/flutter/issues/10089

【问题讨论】:

    标签: ios flutter


    【解决方案1】:

    对不起,这个问题不是 Flutter 造成的。

    GVM(go 的版本管理工具)覆盖 diff 命令。

    所以,diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" &gt; /dev/null 总是失败。

    $ cd /Users/#{your_user_name}/Library/Developer/Xcode/DerivedData/Runner-{some_hash}/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build
    # there are some .sh file. one of them.
    $ cat Script-527F3B8B313E5250A155F99B.sh
    
    
    #!/bin/sh
    diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
    if [ $? != 0 ] ; then
        # print error to STDERR
        echo "error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation." >&2
        exit 1
    fi
    # This output is used by Xcode 'outputs' to avoid re-running this script phase.
    echo "SUCCESS" > "${SCRIPT_OUTPUT_FILE_0}"
    

    修复

    配置 .zshrc 等使用默认的 diff 命令。

    【讨论】:

      猜你喜欢
      • 2020-11-19
      • 2021-01-15
      • 2020-07-11
      • 2021-09-21
      • 1970-01-01
      • 2016-07-24
      • 2020-03-30
      • 2020-07-07
      • 2020-04-29
      相关资源
      最近更新 更多