アプリなどを開発するブログ

React Native / Swift / Ruby on Railsなどの学習メモ。


iOS アプリ作る時に自分が見積ミスりがちな項目

最初の見積段階で忘れてて、無料稼働してしまうということがありました。
忘れないように自分用メモ。

開発期間中にXcode / iOS /Swift のバージョンが上がった際の対応

Xcodeのバージョン上げたらビルド通らなくなる事がよくあった。
理由としてはSwift のバージョンが変わったというのが多かった。
ただ、最近はだいぶ減った。

Xcodeの最新がリリースされてすぐだと、
使ってるライブラリがまだ最新に対応してないというのがちょいちょいあるので注意が必要。

対応バージョンの確認

最新バージョン -1くらいが相場かと。(iOS 11なら、10まで)
スピード重視だったり、ものによっては最新のみでもいいかと。

申請サポート

クライアントが「よく分からない」ってことも多いし、
以外と面倒なことも多い。
なし崩し的に無料でやらずにちゃんと計上しとくのが吉。

申請通らなかった時の対応

1発で通るということはまぁ珍しい。
以下のような時は注意が必要。

  • ユーザーが投稿できる機能がある
  • App内課金がある

デバッグ

実機で確認しなきゃいけない機能がある、さらに、iOS複数バージョン対応、
とかだと結構時間かかる。
開発しながらデバッグして〜と思っててもなかなかそうもいかない。
こちらも今後はしっかり見積に計上しとこ。

ActiveRecordの中間テーブルにupdated_atカラムは要らない場合が多い

ActiveRecordマイグレーションファイルは、
自動で t.timestamps が追加され、created_at と updated_atカラムが追加されます。
中間テーブル自体がモデル同士の関連情報以外を持つ場合は別ですが、
モデル同士の関連情報 (user -- follow -- user とか) の場合は、
レコードがあるかないかの状態しかなく、更新というものが存在しないので、
updated_atは必要ありません。
そういった場合は、

t.timestamp :created_at

と記述することで、タイムスタンプをcreated_atのみとすることができます。
注意点は、タイムスタンプカラムが1つだけの時は、t.timestamp と単数形にすること。

という自分用メモ。

参考コード
class CreateFollow < ActiveRecord::Migration
  def change
    create_table :follows do |t|
      t.timestamp :created_at, null: false
    end
  end
end

フリーランスプログラマ3年間の年収実績を公開してみる

近頃社会でフリーランスという働き方が注目されてきてるのを感じます。
プログラマーというのは中でもフリーランスになりやすい職種だと思います。
自分にはフリーになる前に
「実際フリーになったらいくらくらい稼げるのだろう?ちゃんと生活できるのか?」
という疑問があったので、同じような境遇の方のために直近3年間の売上、収入実績を書いてみたいと思います。

ちなみに自分のスペックはこんな感じです。
- プログラマ8年目くらいの30歳。
- iOSアプリ開発 / Rails でWebアプリ開発がメイン
- Webアプリのフロントエンドもやる。ReactとかVueとか
- React Nativeとかもやる - Unityもやる - デザインもやる
- 受託開発がメイン - 常駐案件もやる
- 人日単価5万円〜 - 仕事は100%知り合いから。営業はしない

3年前

売上 700万 利益 600万くらい

この年は7ヶ月間しか働いてないので、7ヶ月分の実績です。
家で仕事してるので家賃を一部経費に計上してて、あと交際費とかを差し引いたのが利益。

2年前

売上 900万円 利益 750万円くらい

支払家賃に加えてMac買ったり設備投資したり出張あったりで経費が150万くらい。

今年

売上 1150万円 利益 950万円くらい

直前のサラリーマン時代の年収は300~400万円くらいだったので、
数字としては悪くない積み上げ方ができているのではと思います。

納税額は所得税 + 住民税で、毎年80~120万くらいでしょうか。
国民健康保険料は50~70万円くらいだったかと思います。
節税としては、小規模企業共済やってます。

先日聞いたyatteiki.fmというpodcastで、「フリーランスの自分がどれくらい稼いでるか言いづらい」
っていう話を聞いて、なるほど確かにこの話は需要あるかも、と思ったこともあり公開してみました。

参考になるかわかりませんが、この記事が誰かの力になれることを願っています。

Connection to http://localhost:8081/debugger-proxy?role=client timed out. Are you running node proxy? If you are running on the device, check if you have the right IP address in `RCTWebSocketExecutor.m

React Nativeで実機確認しようとしたら出たエラー。
Stop Remote Debugすれば治ります。
実機では、開発メニューは、実機をシェイク(物理的に振る)すると、出てきます。

iPhone で何度も「サインインが必要です [mail] のパスワードを入力してください」と表示される

現在調査中。

考えられる理由の1つは、finishTransactionでちゃんと終了できていないtransactionが存在すること。

参考記事

swift – itunes store にサインイン画面が何度も表示される – まとまりのないブログ

ただ、これは全部終了してるので問題なさそう。

英語の記事漁ってるとapple developerのフォーラムこんなページが。

forums.developer.apple.com

回答全文

Apple answered, but I already do what they say. I also do not want to reset my device. How am I supposed to solve this problem?

 

Answer :

<. I also created a sandbox account to test. But then I forgot the information of this account.>

Your issue may be due to one or more of the following reasons:

 

-You are running into a transient bug with the App Store. The workaround is restore the device to the latest iOS version. Note that doing so will reset your device to its factory default settings.
 

Create a new test user account in iTunes Connect. Make sure that you are signed out of the Store on your device before starting to test In-App Purchase on your device. Build and launch your app on your device, enter the new test user account when prompted by StoreKit to authenticate the purchase. Be sure to always use sandbox test user accounts created in iTunes Connect to test your In-App Purchase products. StoreKit connects to the sandbox environment when you launch your application from Xcode, from your test device (iOS), or from the Finder (OS X). It connects to a production environment for applications that were downloaded from the App Store. You must not use your test user account to sign into the production environment. This will result in your test user account becoming invalid. Invalid test accounts cannot be used to test In-App Purchase again.

-You may have an unfinished transaction.  As such, you need to call finishTransaction: on the associated transaction to end the loop to resolve your issue. See TN2387 In-App Purchase Best Practices > Add a transaction queue observer at application launch  and Finish the transaction for more information  on how to prevent this issue.

-You are calling SKReceiptRefreshRequest or restoreCompletedTransactions, which is prompting you to enter your username and password. If calling restoreCompletedTransactions, see When should I use SKPaymentQueue’ s restoreCompletedTransactions method? for more information. If calling SKReceiptRefreshRequest, that would be the expected behavior.

accounts and it works properly. Even though I am deleted from the sandbox , the account continues to ask. >

If your device still prompts you to log in with a deleted test user account, restore your device to the latest iOS version. Note that doing so will reset your device to its factory default settings.

Be sure to not restore your device’s back up. Make sure that you are signed out of the Store on your device before starting to test In-App Purchase on your device. Build and launch your app on your device, enter the new test user account when prompted by StoreKit to authenticate the purchase.

モダンなshell、fish を導入する

f:id:device_me:20180223100752p:plain

fishとは?

「shell はだいたいこういうカスタマイズするよね〜」というものがだいたい最初から整ってるshellって感じです。
zshなどに比べて導入やカスタマイズが容易。
zshbashとカスタマイズ方法やPATHの通し方が異なっていたりするので、少し導入を躊躇していましたが、
結構導入している人多そうだったので思い切って移行してみることにしました。
結論としてはめっちゃオススメです。

fishshell.com

fish 導入

$ brew install fish
$ sudo vi /etc/shells  #  /usr/local/bin/fish を追記する
$ chsh -s /usr/local/bin/fish # デフォルトのshellを変更

fisherman (プラグインマネージャ) 導入

$ curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher

各種プラグイン導入

個人的に必須なのは z と peco

$ fisher z

$ z hoge # hoge にマッチするディレクトリが移動履歴の中にあれば移動 $ zo hoge # 上記と同様だが、該当ディレクトリをFinder で開

$ brew install peco # peco入ってなければインストール
$ fisher oh-my-fish/plugin-peco

~/.config/fish/config.fish

function fish_user_key_bindings
  bind \cr 'peco_select_history (commandline -b)'
end

anyenv のセットアップ

anyenvに関してはこちらのエントリを参考にしました。 patorash.hatenablog.com

超快適!オススメです。

参考記事

dev.classmethod.jp

qiita.com

qiita.com

futurismo.biz