Fabric bataへアプリをアップロードする

プロジェクトに直接インストールしている場合


./Crashlytics.framework/submit API_KEY BUILD_SECRET -ipaPath IAP_PATH

CocoaPodsを使ってインストールしている場合


./Pods/Crashlytics/submit  API_KEY BUILD_SECRET -ipaPath IAP_PATH


その他のオプション
     Usage:
        submit  API_KEY BUILD_SECRET        default options for upload after archive, with ipa path in environment
         additional options:
         -help                          display this message
         -ipaPath           [path to IPA]
         -emails            [tester email address],[email]
         -groupAliases      [group build server alias],[group]
         -notesPath         [release notes]
         -notifications     YES|NO
         -debug             YES|NO

In-App Purchaseを調べてみた

公式ドキュメント


開発環境で動作確認

iTunes connectでcontact infoやbank info、tax infoなどもろもろを登録する必要あり

シミュレータ

購入自体は可能だが、レシートは取得できない


ライブラリ


良さげ、Swift3.0に対応

ただし!

トランザクション処理に注意。


終了トランザクション

公式ドキュメントによると

終了していないトランザクションは終了するまではキューに残されたままになります。 
アプリケーションが起動されるたびにアプリケーションによって未完のトランザクションを終了できるように、トランザクションキューのオブザーバが呼び出されます。

アプリが途中で終了したりしても復活してくれる。
ゲームのコイン購入なんか、StoreKitの購入はできたけど、サーバに付与処理を行う前に、
ネットワークが切れて、アプリKillして・・・ってなってもまた起動時にオブサーバが呼ばれるので、安心。


ですが、ほとんどのライブラリは、ライブラリ内で処理完了にしてしまってます。

なのでStoreKitにトランザクション完了を知らせる前に、カスタムの処理を追加できるようなライブラリを作ろう・・・。

Railsの開発環境をDockerで作った時にハマったところ Rails, Nginx, Redis, MySQL

docker-composeを使って構築する時にハマったところ


ホストマシン(Macのローカル環境)とDockerコンテナとのやりとり


 - ports ( -pオプション)でやりとりできるのはホストマシンのPortをマッピングする

なので

Dockerコンテナ同士のPortをマッピングしているわけではない

例えば、MySQLのコンテナ(Port:3306)にホストマシンからアクセスできるからといって、Railsを動かしているコンテナからアクセスはできない。


ホストマシン : mysql -h127.0.0.1 -uroot => OK
Railsコンテナ : mysql -h 127.0.0.1 -uroot => NG

linksを使って指定すれば、名前解決できるのでそれを使ってアクセスする

links:
    - mysql

Railsコンテナ : mysql -h mysql -uroot => OK


RailsアプリのMySQLへの接続、Redisへの接続などはホスト名の指定方法を変更する必要がある!!

修正前
database.yml
  host: localhost

development.rb
  config.session_store :redis_store,
                       servers: 'redis://localhost:6379/0',

修正後
database.yml
  url: mysql2://root:@mysql:3306

development.rb
  config.session_store :redis_store,
                       servers: 'redis://redis:6379/0',

Railsアプリの共有方法

ディレクトリ構成を以下のようにしていた

任意のディレクトリ/RailsApp/
  Gemfile
  app
  bin
  config
  db
  docker-compose/
    nginx/
      Dockerfile
      app.conf
    app/
      Dockerfile
    docker-compose.yml
    
そうすると、appのDockerfileに書くRailsAppのパスが親のパスになるため、Permissionエラーとなる

COPY .. /app
 
なのでdocker-compose.ymlとRailsアプリのDockerファイルはルートディレクトリに置くようにした



Xcode8 Swift3への対応

Swift3へのConvertでエラーとなって手動で直した部分


UICollectionDataSource

-    override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
+    override func numberOfSections(in collectionView: UICollectionView) -> Int {


-    override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+    override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {


-    override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
+    override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {



UITableViewDataSource


-    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
+    override func numberOfSections(in tableView: UITableView) -> Int {


-    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {


-    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
+    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {



-    override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
+
+    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {



CGGeometory

-        frame = CGRectMake(0.0, 0.0, self.view.frame.width, self.view.frame.height)
+       frame = CGRect(x: 0.0, y: 0.0, width: self.view.frame.width, height: self.view.frame.height)


UIVIewController

-     override func shouldAutomaticallyForwardAppearanceMethods() -> Bool {
+    override var shouldAutomaticallyForwardAppearanceMethods: Bool {



Cocoapods

"Use Legacy Swift Language Version"のエラーが出た場合、該当のフレームワークのBuild Settingsで「Use Legacy Swift Language Version」の設定をNOにする



Cocoapods 1.0.0にアップデートした時の対応

ターゲットの指定が必須

0.39.0の記述

platform :ios, "8.0"
use_frameworks!

pod 'Google/Analytics'
pod 'AFNetworking'
pod 'SSKeychain'
pod 'SVProgressHUD'


1.0.0の記述

platform :ios, "8.0"
use_frameworks!

target "Sample" do
  pod 'Google/Analytics'
  pod 'AFNetworking'
  pod 'SSKeychain'
  pod 'SVProgressHUD'
end



Acknowledgementsファイルのパスの変更

0.39.0
FileUtils.cp_r('Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.plist', 'Sample/Settings.bundle/Acknowledgements.plist', :remove_destination => true)

1.0.0
FileUtils.cp_r('Pods/Target Support Files/Pods/Pods-acknowledgements.plist', 'Sample/Settings.bundle/Acknowledgements.plist', :remove_destination => true)

ActiveMailerのエラー

rails4.2 ActiveMailerを使っていて、メールが送られてそうなログは表示されるが、
実際にはメールが送られていない。


SystemMailer#system_email: processed outbound mail in 187.9ms


例えば、

mail(to: user.email, subject: "#{ message.creator.namename }さんから返信来てます" )

のようなコードがあると、実際にsubjectの文字列が作られるのはActiveJobの方?


なので、呼び出し側ではエラーはキャッチできない。

原因は調査中

bunder1.10.5を使い続ける><

rails + rspec + springを使ってて、bundlerを1.12にあげると以下のエラーが。

本当はもっとあったけど、ログに残ってない。

bundle/ruby/2.2.0/gems/guard-rspec-4.6.2/lib/guard/rspec_formatter.rb -f Guard::RSpecFormatter --failure-exit-code 2


原因がわかるまではbundlerを1.10.5からアップデートしない。

ReactNativeでAndroid対応する話

前提 ReactNativeでiOS版のアプリをリリースしていて、Android版をリリースする話 トラブルシューティング Build.VERSION_CODES.Q が存在しないエラー compileSdkVersionを29以上にすると解決 メモリー足りないエラー Execu...