Closed17

flutterのios 開発環境分離

mattakmattak

iOSもandroidのproduct favor的な設定をしたい.
flutterでの設定方法しらべる

mattakmattak

とりあえず、名前、bundle id, アイコンを変えよう

mattakmattak

firebaseのエラー

$ pod install --repo-update
[!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
  In snapshot (Podfile.lock):
    Firebase/CoreOnly (= 8.0.0)

  In Podfile:
    firebase_core (from `.symlinks/plugins/firebase_core/ios`) was resolved to 1.4.0, which depends on
      Firebase/CoreOnly (= 8.3.0)


You have either:
 * changed the constraints of dependency `Firebase/CoreOnly` inside your development pod `firebase_core`.
   You should run `pod update Firebase/CoreOnly` to apply changes you've made.
mattakmattak
$ flutter run --flavor develop 
...
    [!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
      In snapshot (Podfile.lock):
        Firebase/CoreOnly (= 8.0.0)

      In Podfile:
        firebase_core (from `.symlinks/plugins/firebase_core/ios`) was resolved to 1.4.0, which depends on
          Firebase/CoreOnly (= 8.3.0)


    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
     * changed the constraints of dependency `Firebase/CoreOnly` inside your development pod `firebase_core`.
       You should run `pod update Firebase/CoreOnly` to apply changes you've made.
...
Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update

pod repo updateしても何も変わらない

mattakmattak
$ pod update Firebase/CoreOnly

でいけたが...

./ios/Runner/en.lproj/InfoPlist.strings:1:1: error: read failed: Couldn't parse property list because the input data was in
    an invalid format (in target 'Runner' from project 'Runner')
mattakmattak
$ plutil ios/Runner/en.lproj/InfoPlist.strings
2021-08-17 09:08:40.783 plutil[69117:2464691] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 9. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
ios/Runner/en.lproj/InfoPlist.strings: Unexpected character / at line 1

stringsファイルのsemicolonがなかっただけだった..

mattakmattak

下記で無事に起動OK

$ flutter run --flavor develop --target lib/main_dev.dart
mattakmattak

RunScriptでCFBundleNameに[dev]をつけたり外したりする感じにした

SCHEME=$(echo "$CONFIGURATION" | awk -F'-' '{print $2}')

if [ $SCHEME = "develop" ]; then
  find "$SRCROOT/Runner" -type f -name 'InfoPlist.strings' |
    xargs -n1 sed -i '' -E 's|CFBundleDisplayName = "([^\[\]+)"|CFBundleDisplayName = "[dev]\1"|'
else
  find "$SRCROOT/Runner" -type f -name 'InfoPlist.strings' |
    xargs -n1 sed -i '' -E 's|CFBundleDisplayName = "\[.+\](.+)"|CFBundleDisplayName = "\1"|'
fi
このスクラップは2021/11/18にクローズされました