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

2021年11月03日

[iOS] モバイル用AWSのSDKがバージョン2.19.1より上げられないときの対応

■ 注意 ■ 2021年11月18日追記
iOS版はうまくいったけど、Android版はビルドできませんでした。
理由はSDKの更新が止まっていたから!
AWSのUnity用SDKはプラグインという形での公開はとっくにやめていて、.NETのSDKの方だけ更新されているようです。
詳しくは、後日に記事にします。



iOS版100マス計算でAWSの
・Lambda
・DynamoDB
を使っています。

前回の件があって、最新のSDKに切り替えようとしたところ、2.19.1より上げられない事態になりました。

CocoaPodsの中身:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '11.0'
use_frameworks!

target :'[PJ名]' do
pod 'AWSCognito'
pod 'AWSCognitoIdentityProvider'
pod 'AWSDynamoDB'
pod 'AWSLambda'
end


バージョンを上げられるか調べてみたところ。

$ pod outdated
...
Analyzing dependencies
The color indicates what happens when you run `pod update`
- Will be updated to the newest version
- Will be updated, but not to the newest version because of specified version in Podfile
- Will not be updated because of specified version in Podfile

The following pod updates are available:
- AWSCognitoIdentityProvider 2.19.1 -> 2.19.1 (latest version 2.26.3)
- AWSCognitoIdentityProviderASF 2.19.1 -> 2.19.1 (latest version 2.26.3)
- AWSCore 2.19.1 -> 2.19.1 (latest version 2.26.3)
- AWSDynamoDB 2.19.1 -> 2.19.1 (latest version 2.26.3)
- AWSLambda 2.19.1 -> 2.19.1 (latest version 2.26.3)

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


最新版が2.26.3なのに、上げられない。

調べたところ、CocoaPodsの「Cognito」を「AWSMobileClient」にすることで対処できた。

参考:
https://cocoapods.org/pods/AWSLambda
https://github.com/aws-amplify/aws-sdk-ios

補足:
AWSMobileClientのpod installがSWIFT_VERSIONのエラーで止まるときの対応
https://qiita.com/akira-greennote/items/462fe5d4c381c1aba6ee

CocoaPodsで変更した箇所:

target :'AWSTest2021' do
pod 'AWSMobileClient'
pod 'AWSDynamoDB'
pod 'AWSLambda'
end

すると、2.26.3に上げられるようになった。
$ pod outdated
...
Analyzing dependencies
The color indicates what happens when you run `pod update`
- Will be updated to the newest version
- Will be updated, but not to the newest version because of specified version in Podfile
- Will not be updated because of specified version in Podfile

The following pod updates are available:
- AWSCognitoIdentityProvider 2.19.1 -> 2.26.3 (latest version 2.26.3)
- AWSCognitoIdentityProviderASF 2.19.1 -> 2.26.3 (latest version 2.26.3)
- AWSCore 2.19.1 -> 2.26.3 (latest version 2.26.3)
- AWSDynamoDB 2.19.1 -> 2.26.3 (latest version 2.26.3)
- AWSLambda 2.19.1 -> 2.26.3 (latest version 2.26.3)

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


対応した内容はシンプルなものの、調べるのに時間がかかった。
なんとか対応できてよかったー。

↓無事、インストールできた
スクリーンショット 20211031_1.png

posted by be-style at 15:50| Comment(0) | iOS

2021年09月26日

[iOS] AdMobのテスト用IDFAを登録したら、収益が激減した話

アプリの更新作業で、AdMob管理画面からテスト端末を登録できる事を知りました。
方法は、

AdMob管理画面 > 設定 > テストデバイス > テストデバイスを追加

を選び、iPhoneのIDFAを登録します。
IDFAの取得方法は、プログラム(Objective-C)に以下を記載します。

----------------------------------------
// 広告IDを確認(AdMobの管理画面でテスト広告の設定に使用)【AdSupport.framework必須】
ASIdentifierManager *identifierManager = [ASIdentifierManager sharedManager];
NSString *idfa = identifierManager.advertisingIdentifier.UUIDString;
NSLog(@"[IDFA] %@", idfa);
----------------------------------------

これでAdMob管理画面から「テストデバイスを追加」で、上記で取得したIDFAを登録します。
すると、広告の中に「Test mode」という表示が出るので、テスト広告が表示されているとすぐにわかります。

blog20210926_2.png

がしかし、上記のプログラムで「00000000-0000-0000-0000-000000000000」が出たので
それをAdMob管理画面に登録してしまった場合、他のiPhoneでもテストモードになることがわかりました!
これはiOS14以上のiPhoneのトラッキングの追跡設定(設定 > プライバシー > トラッキング)が影響していると
思われます。

blog20210926_3.PNG

やけに広告収益が落ちたと思ったら、これが原因っぽかったです。
2日気づかなかったのは痛い!

みなさんもご注意ください。
posted by be-style at 21:41| Comment(0) | iOS