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

2022年09月20日

[Unity] In App Purchasing 4.4.1 にアップデートして出たエラー対応

Unityのパッケージ「In App Purchasing」をPackage Managerを使って、バージョン4.4.1にアップデートしたところ、ビルドエラーが出てしまいました。
その時の対応です。

------------------------------------
Library/PackageCache/com.unity.purchasing@4.4.1/Runtime/SecurityStub/AppleValidator.cs(53,16): error CS0433: The type 'AppleReceipt' exists in both 'Security, Version=1.0.7268.24073, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
------------------------------------

■対応
・Unityを終了
・Finderから、Unityプロジェクト/Library/PackageCache の中身をすべて削除
・Unityを起動

すると、別のエラーが出ました。

------------------------------------
Library/PackageCache/com.unity.purchasing@4.4.1/Runtime/SecurityStub/CrossPlatformValidator.cs(43,16): error CS0433: The type 'IPurchaseReceipt' exists in both 'Security, Version=1.0.7268.24073, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
------------------------------------

変数「Security」の宣言が重複してるのかな?

■対応
・Unityを終了
・Finderから、2つのディレクトリを削除
 →Unityプロジェクト/Plugins > UnityChannel
 →Unityプロジェクト/Plugins > UnityPurchasing
・Unityを起動し、Package Manager で「In App Purchasing」を remove -> install
※参考 : https://teratail.com/questions/167808

今度は、プログラムの内容についてのエラーが出た。

------------------------------------
error CS1061: 'IGooglePlayConfiguration' does not contain a definition for 'SetPublicKey' and no accessible extension method 'SetPublicKey' accepting a first argument of type 'IGooglePlayConfiguration' could be found (are you missing a using directive or an assembly reference?)
------------------------------------

■対応
・SetPublicKeyの箇所をコメントアウト。
(「In App Purchasing 2.2.0」から、SetPublicKeyは廃止になったらしい)
※参考 : https://forum.unity.com/threads/alternative-to-setpublickey.1092364/

これでビルドエラーが消えた。
後でテストしてみよう。
posted by be-style at 17:00| Comment(0) | Unity