2023年09月14日

[Unity+Android] 実機でアプリ内課金(In App Purchasing)をキャンセルするとエラーが出る件

■環境
Unity2022.3.7f1
In App Purchasing4.9.4(Package Manager)

Android13の端末を使ってアプリ内課金のテストをしていたところ、
購入をキャンセルしたときにエラーが出ました。

-----------------------------------
Error Unity Exception: No such proxy method: UnityEngine.Purchasing.GooglePurchaseUpdatedListener.onPurchasesUpdated(UnityEngine.AndroidJavaObject,null)
-----------------------------------

他にも同じエラーで困っている人がいて、Unityの不具合っぽいです。
以下のバージョンから修正されるそうなので、待つしかないかー。

2021.3.31f1
2022.3.10f1
2023.1.13f1
2023.2.0b9
2023.3.0a1

参考:
https://forum.unity.com/threads/onpurchasefailed-is-not-called-unity-2022-3-5f1-iap4-9-3-android-platform.1463681/page-2
posted by be-style at 10:57| Comment(0) | Unity

2023年05月02日

[iOS] Xcode14.3を使って申請しようとしてiTunesConnectでGameCenterの警告が出たときの対処

Xcode14.3にしてからアプリを申請しようとしたところ、iTunes Connectで警告が出た。

スクリーンショット 20230501_1.png

読むと、どうもXcode側でGameCenterの設定が必要らしい。
このアプリは何度も更新してきたけど、Xcode14.3に上げて初めて見た警告だった。

警告文の最後の 「Learn More」 のリンクの説明を読む。

https://developer.apple.com/documentation/gamekit/enabling_and_configuring_game_center?language=objc

英語でわかりにくかったので、自分用にメモ。

・Xcode の TARGETSを選択。
・Signing & Capabilities タブを選択。
・課金機能を使っているので、画面下には「In-App Purchase」があるけど、GameCenterがない。

スクリーンショット 20230501_2.png

・画面左上にある「+Capability」を押す
・Capabilitiesウィンドウが立ち上がるので、「Game Center」をWクリック

スクリーンショット 20230501_3.png

すると、先ほどの場所に「Game Center」が追加された。

スクリーンショット 20230501_4.png

この状態でアプリをアーカイブしてiTunes Connectにアップロードして申請しようとすると、始めにあった警告は表示されなかった。
めでたしめでたし。
posted by be-style at 00:30| Comment(0) | iOS

2022年11月15日

[iOS] Objective-CにおけるkeyWindowの取得

アプリをメンテしていたら、keyWindowが非推奨だと怒られたので修正した。

【旧】
UIApplication.sharedApplication.keyWindow

【新】
UIApplication.sharedApplication.windows.firstObject

参考:
https://qiita.com/water_bath/items/15b4eff558c9721d3365
posted by be-style at 16:49| Comment(0) | iOS

[iOS] Xcode13→14にしたらビルドエラーになった

iOS16のテスト端末にアプリを入れようとしたら、Xcode14じゃないとダメっぽいことがわかり、Xcode14にバージョンアップしました。
すると、ビルドが通らなくなってしまいました。
ログを見ると、どうもswift関連のエラーのようでした。


Could not find or use auto-linked library 'swiftCore'
Could not find or use auto-linked library 'swiftCompatibility50'
Could not find or use auto-linked library 'swiftCoreGraphics'
Could not find or use auto-linked library 'swiftCoreImage'
Could not find or use auto-linked library 'swiftFileProvider'
Could not find or use auto-linked library 'swiftObjectiveC'
Could not find or use auto-linked library 'swiftFoundation'
Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
Could not find or use auto-linked library 'swiftDarwin'
Could not find or use auto-linked library 'swiftCompatibility51'
Could not find or use auto-linked library 'swiftQuartzCore'
Could not find or use auto-linked library 'swiftUIKit'
Could not find or use auto-linked library 'swiftCompatibilityConcurrency'
Could not find or use auto-linked library 'swiftMetal'
Could not find or use auto-linked library 'swiftDispatch'
Could not find or use auto-linked library 'swiftCoreFoundation'
Could not find or use auto-linked library 'swiftDataDetection'
Could not find or use auto-linked library 'swift_Concurrency'


Objective-Cで実装しているので、このエラーが出ているような予感。。。
なので、プロジェクト内にダミーのswiftファイルを作成。

Xcode左下にある「+」ボタン > New File... > Swift File > dummy.swift を作成

中身は何もいじらないでビルドしたら、無事ビルドが通りました。
よかった!
posted by be-style at 10:44| Comment(0) | iOS

2022年09月24日

[Unity] Unity2022にバージョンアップしたらURPを更新しろと言われたときの対応

Unity2020→2022 にバージョンアップしてURP(Universal Render Pipeline)を使っているプロジェクトを開いたところ、Unity起動時に「使っているURPをアップグレードしろ」というメッセージが出た。

スクリーンショット20220920.png

対処しないと、URPを使っているシェーダーの色がおかしくなっていた。

以前も似たことがあったので、同じ対応をしたら解決した。

■手順
・Projectウィンドウから、該当するURPファイルを見つけてWクリック(または、シングルクリック > Inspectorウィンドウ > Open Shader Editor)
・Shader Editorの左上メニュー「Save Asset」を押すと、上書きされる

これでシェーダーの色は正常に戻った。
posted by be-style at 22:26| Comment(0) | Unity