アプリをメンテしていたら、keyWindowが非推奨だと怒られたので修正した。
【旧】
UIApplication.sharedApplication.keyWindow
↓
【新】
UIApplication.sharedApplication.windows.firstObject
参考:
https://qiita.com/water_bath/items/15b4eff558c9721d3365
2022年11月15日
[iOS] Objective-CにおけるkeyWindowの取得
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 を作成
中身は何もいじらないでビルドしたら、無事ビルドが通りました。
よかった!
すると、ビルドが通らなくなってしまいました。
ログを見ると、どうも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)
↓スクショ

最新版が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)
↓スクショ

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

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`
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)
↓スクショ

最新版が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`
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)
↓スクショ

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

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」という表示が出るので、テスト広告が表示されているとすぐにわかります。

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

やけに広告収益が落ちたと思ったら、これが原因っぽかったです。
2日気づかなかったのは痛い!
みなさんもご注意ください。
方法は、
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」という表示が出るので、テスト広告が表示されているとすぐにわかります。

がしかし、上記のプログラムで「00000000-0000-0000-0000-000000000000」が出たので
それをAdMob管理画面に登録してしまった場合、他のiPhoneでもテストモードになることがわかりました!
これはiOS14以上のiPhoneのトラッキングの追跡設定(設定 > プライバシー > トラッキング)が影響していると
思われます。
やけに広告収益が落ちたと思ったら、これが原因っぽかったです。
2日気づかなかったのは痛い!
みなさんもご注意ください。
posted by be-style at 21:41| Comment(0)
| iOS
[iOS] 100マス計算にミニゲーム「飛び石」が追加されました
iOS版の100マス計算をアップデートしました。
今回の更新の目玉は、ミニゲーム「飛び石」の追加です。

飛び石の上を落ちないように進むというゲームです。
シンプルだけど、妙に癖になります。
よろしかったら、遊んでみてくださいー。
App Store:
https://apps.apple.com/jp/app/id534131439
今回の更新の目玉は、ミニゲーム「飛び石」の追加です。

飛び石の上を落ちないように進むというゲームです。
シンプルだけど、妙に癖になります。
よろしかったら、遊んでみてくださいー。
App Store:
https://apps.apple.com/jp/app/id534131439
posted by be-style at 12:58| Comment(0)
| iOS