5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

App Extensionのバージョンを自動で揃える (CFBundleVersion Mismatch)

Last updated at Posted at 2018-08-05

CFBundleVersionとCFBundleShortVersionString Mismatch の自動対応方法

  • App Extension(画像付きPush や WatchKit Extension)を使ってるアプリで、申請する際に出てくる、下記の警告の自動対応したいから書いた記事

警告内容

CFBundleVersion Mismatch
CFBundleShortVersionString Mismatch

Sync Bundle Version

SyncBundleVersion
# !/bin/bash
build_number=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "path/to/Info.plist")
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $build_number" "path/to/ExtensionInfo.plist"

build_number=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "path/to/Info.plist")
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $build_number" "path/to/ExtensionInfo.plist"

実行内容

  1. 親アプリのCFBundleVersionを取得(path/to/Info.plist)
  2. ExtensionのCFBundleVersionを上書き(path/to/ExtensionInfo.plist)
  3. 親アプリのCFBundleShortVersionStringを取得(path/to/Info.plist)
  4. ExtensionのCFBundleShortVersionStringを上書き(path/to/ExtensionInfo.plist)

終わりに

  • 単純にExtensionのInfo.plistのBundle versionに親アプリの環境変数を入れられたら解決なのだけども、標準だと見つからなかった
  • 他の方法があれば教えてください
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?