muapps

iOSアプリ開発で得られた知見をメモ代わりに投稿します。

プログレスインジケータ実装

通信中にクルクルするやつ。

extension UIViewController {
  /// プログレスインジケータを表示する
  func displayProgressIndicator() {
    // UI更新はメインスレッドで行う
    DispatchQueue.main.async {
      let indicator = UIActivityIndicatorView(style: .whiteLarge)
      indicator.color = .gray

      let coverViewController = UIViewController()
      coverViewController.view.backgroundColor = .darkGray
      coverViewController.view.alpha = 0.9
      coverViewController.modalPresentationStyle = .overFullScreen
      indicator.center = coverViewController.view.center
      coverViewController.view.addSubview(indicator)

      self.present(coverViewController, animated: false, completion: nil)
      indicator.startAnimating()
    }
  }
  /// プログレスインジケータを閉じる
  func dismissProgressIndicator() {
    // UI更新はメインスレッドで行う
    DispatchQueue.main.async {
        self.presentedViewController?.dismiss(animated: false, completion: nil)
    }
  }
}

UIViewControllerを継承したクラスの中で

// プログレスインジケータ表示
self.displayProgressIndicator()
// プログレスインジケータ閉じる
self.dismissProgressIndicator()

Swiftで値をハッシュ化する(SHA256)

ネットで調べると以下の方法が見つかりました。

  1. CommonCrypto(標準搭載)
  2. CryptoKit(標準搭載、iOS13以上)
  3. CryptoSwift(外部ライブラリ)

1のCommonCryptoは初めから搭載されており、Xcode10以降では単純にCommonCryptoをインポートするだけで使えるようです。
SwiftプロジェクトでCommonCryptoをインクルードする[Xcode10では不要] - Qiita

 import CommonCrypto

実装に関しては以下の記事が参考になりそうです。

Swift で SHA256 の値を取得する - Qiita

コードの中身が理解できていないですが。。

CryptoKitは以下の記事に書いてあるようにiOS13以上が要求されるため、実際に使用するのはもう少し経ってからになりそうですね。

CryptoKitの調査、CryptoKit以前とCryptoKitでできることをサンプルコードとテストで説明 - Qiita

AppStore用プレビュー画像の作り方

f:id:muapps:20200217012230p:plainf:id:muapps:20200217012506p:plain
左: スクショのみ、右: スクショ+文字

ASO対策的にスクリーンショットをそのまま貼り付けるより、機種のイメージにはめ込んで周りに文字をつけたほうがいいとされています。 このようなAppStore用プレビュー画像を作成する方法としては2通りあると思います。

  1. サービスを利用する
    APPLAUNCHPADなど

  2. 自分で作る

1を使えば簡単にできると思いますが、無料分以上の機能を使うにはそれなりにお金がかかります。 ここでは私がサービスを使わず自力で作成した手順を自分用メモを兼ねてまとめます。

もっと簡単な方法や標準的な方法があればコメントもらえると嬉しいです。

プレビュー画像の作り方

  1. スクリーンショットを撮る。
    機種によってはノッチがあったり画面の角が丸くなっているためスクリーンショットを加工する。
    以下のサイトではドラッグ&ドロップで加工してくれる。
    iPhone X / XSなどのスクリーンショットを角丸化&ノッチを再現するツールβ

  2. アートワークを以下からダウンロードする。
    Apple製品画像

  3. 画像編集ソフト(フリーならGimpなど)でアートワークとスクショを合成し、PNG形式で書き出す。

  4. Keynoteでスライドの画面サイズを指定のサイズ(スクリーンショットの仕様)に設定して作成した画像と好きなテキストを挿入する。

まとめ

スクリーンショットは長方形なので、機種によってノッチがあったり角丸になっていると加工方法に悩みますね。
自力で作るときみんなどうやってるんだろう。。

Privacy Policy

built the ToDoリスト 好きなところに入力できるタスクリスト app as a Free app. This SERVICE is provided by at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at ToDoリスト 好きなところに入力できるタスクリスト unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information. The information that I request will be retained on your device and is not collected by me in any way.

The app does use third party services that may collect information used to identify you.

Link to privacy policy of third party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device's internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;

  • To provide the Service on our behalf;

  • To perform Service-related services; or

  • To assist us in analyzing how our Service is used. I want to inform users of this Service that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at muappscontact@gmail.com.

This privacy policy page was created at privacypolicytemplate.net and modified/generated by App Privacy Policy Generator

CocoaPodsをgitignoreに追加する手順

CocoaPodsをGitに含めない場合、PodfileとPodfile.lockのみGitに含める。

Pods/以下のファイルをgitignoreに追加する

Pods/*

もしくは

ディレクトリ名/Pods/*

すでにGit管理に含めている場合
  1. ローカルでPodsディレクトリを削除してコミット、プッシュする

  2. GitIgnoreに追加しただけでは追跡され続けるので、Gitのキャッシュを削除する

git rm -r --cached Pods

※1はやらなくていいかも(?)

ブランチモデルについて

ブランチモデルの採用

iOSアプリ開発をしていてブランチ運用について曖昧だったので、調べました。

私の場合、以下の理由で基本的にgit-flowを採用することにしました。

  • 調べた限りモバイルアプリではgit-flowの採用が多いので、現場が変わっても馴染みやすい。

  • モバイルアプリではWebに比べてリリースサイクルが長い。  

Git Flow

git-flowについては以下の記事で紹介されています。

2010年、オランダのエンジニアVincent Driessenさんの一提案に過ぎなかったgitのブランチモデル A successful Git branching model はその後、世界中に広く浸透し今やgit運用モデルとしてデファクトスタンダードになりました。

qiita.com

なおgit-flowはツールとモデル両方の名称として使われるようですが、ここでは後者の意味で取り扱います。

git-flowには以下のブランチがあります。

  • master
    リリースの状態。リリースごとにタグを打つ。

  • develop
    開発ブランチ。

  • release
    リリース準備が整ったらdevelopからチェックアウトする。
    リリースが完了したらmaster、develop両方にマージする。

  • feature
    機能ごとの作業ブランチ。developにマージする。

  • hotfix
    masterからチェックアウト。リリース版の緊急修正。

その他のブランチモデル

  • Git-Flow

  • Github Flow

  • Gitlab Flow

  • GitFeatureFlow

Webではリリースサイクルが短いため、git-flowを簡略化したGithub-Flowなどが採用されているようです。

 

iOSアプリに新バージョンの要素が適用(反映)されるタイミング

 新バージョンiOSSDKを含んだXcodeにアップデートしたとき(と思われる)。

 

例えばXcode11のリリースノートを見ると、iOS13のSDKを含んでいるとの記述があります。1つ前のバージョン10.3ではこれを含んでいないことも分かります。

f:id:muapps:20190928235718p:plain

Xcode11と10.3のリリースノート

なので、Xcode10.3からXcode11にアップデートしてアプリを申請・公開すると

iOS13の新要素がアプリに反映されます。

 

逆に言うと、iphoneiOSをアップデートしても自分のアプリをそのiOSバージョンのSDKを含んだXcodeでArchiveして申請、公開しない限り新要素は適用されません。

 

SDK(Software Development Kit)なので、なるほどという感じはしますね。

 

間違っていたらコメントなどで指摘いただけると嬉しいです!