首页 文章

添加shared_preferences后,我无法构建Flutter的iOS模拟器

提问于
浏览
0

在我向pubspec.yaml添加shared_preferences后,iOS sumulator永远不会成功构建 .

我试过了

  • 颤抖干净

  • 升级cocoapods

  • pod安装

  • pod卸载

  • pod deintegrate

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

版本

~/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

1 回答

  • 0

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

    GVM(a version management tool of go) overrides diff command.

    所以, diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /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命令 .

相关问题