2019年 3月 29日の投稿一覧

GADInvalidInitializationException-GoogleMobileAdsアップデートしたら動かなくなった

GADInvalidInitializationExceptionが発生

GoogleMobileAdsをアップデートしたら、iOSアプリがクラッシュするようになってしまった。


2019-03-29 17:20:39.153251+0900 test.app[9165:102709] *** Terminating app due to uncaught exception 'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized incorrectly. Google AdMob publishers should follow instructions here: https://googlemobileadssdk.page.link/admob-ios-update-plist to include the AppMeasurement framework, set the -ObjC linker flag, and set GADApplicationIdentifier with a valid App ID. Google Ad Manager publishers should follow instructions here: https://googlemobileadssdk.page.link/ad-manager-ios-update-plist'
*** First throw call stack:

GADInvalidInitializationExceptionの原因

いままでAppDelegateでGADMobileAds.configure( APPID )してましたがこれがとうとうダメになったようです。

‘configure(withApplicationID:)’ is deprecated: Use [GADMobileAds.sharedInstance startWithCompletionHandler:]


 GADMobileAds.configure(withApplicationID: 

今後はInfo.plistにGADApplicationIdentifierを追加するらしいです。


GADApplicationIdentifier
ca-app-pub-123~????????

Androidはちょっと前からmanifest.xmlに追加が必要になっていたので同じ感じ。
Googleが解析しやすいようにするのかな?

carthageでpkluz/PKHUDがBuild Failed – バージョン指定を間違えてビルドエラー


$ cat Cartfile
github "pkluz/PKHUD" ~> 4.0

$ carthage update --platform iOS PKHUD
*** Building scheme "PKHUD" in PKHUD.xcodeproj
Build Failed
	Task failed with exit code 65:
	/usr/bin/xcrun xcodebuild -project /Users/dp/dev/Xcode/test.app/Carthage/Checkouts/PKHUD/PKHUD.xcodeproj -scheme PKHUD -configuration Release -derivedDataPath /Users/dp/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2_10E125/PKHUD/4.2.3 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/bv/0637g83s7bz_l040pkghmt380000gn/T/PKHUD SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/dp/dev/Xcode/test.app/Carthage/Checkouts/PKHUD)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/bv/0637g83s7bz_l040pkghmt380000gn/T/carthage-xcodebuild.15y1aS.log

Build Failed , Task failed with exit code 65

ログを確認します。


cat /var/folders/bv/0637g83s7bz_l040pkghmt380000gn/T/carthage-xcodebuild.15y1aS.log

note: Planning build
note: Constructing build description
Build system information
error: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'PKHUD')

Build system information
error: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'PKHUD')

** ARCHIVE FAILED **

バージョン指定間違ってた。。


$ cat Cartfile
- github "pkluz/PKHUD" ~> 4.0
+ github "pkluz/PKHUD" ~> 5.0

https://github.com/pkluz/PKHUD

Xcode10.2 (10E125)にしたらcarthageでIncompatible Swift version

carthageはバイナリが準備されていればダウンロードしてビルド短縮しますが
importしたバイナリがXcodeのアップデートで4から5になってしまったので
buildした環境と変わってしまったのでエラーが出てしまいました。


Skipped installing FontAwesome.swift.framework binary due to the error:
	"Incompatible Swift version - framework was built with 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1) and the local version is 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)."

version0.20からはSwiftのバージョンが異なる場合ビルドしてくれるそうなので
Carthageをバージョンアップしました。


brew upgrade carthage

version0.20からはSwiftのバージョンが違ったので「Falling back to building from the source」を勝手に実行してくれました。


** Downloading FontAwesome.swift.framework binary at "Dynamic Type"
***  Skipped installing FontAwesome.swift.framework binary due to the error:
	"Incompatible Swift version - framework was built with 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1) and the local version is 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)."

    Falling back to building from the source