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

时间:2018-10-18 00:09:19

标签: ios flutter

在将shared_preferences添加到pubspec.yaml后,iOS汇总器无法成功构建。

我尝试过

  • 干净整洁
  • 升级cocoapods
  • pod安装
  • 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

1 个答案:

答案 0 :(得分:0)

对不起,此问题不是由Flutter引起的。

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

所以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命令。