capacitor-google-tag-manager 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorGoogleTagManager.podspec +2 -0
- package/Package.swift +7 -2
- package/README.md +4 -2
- package/package.json +1 -1
|
@@ -17,4 +17,6 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
# Any 9.x from 9.1.0, as in Package.swift. An app pins another one in its Podfile: pod 'GoogleTagManager', '9.3.0'
|
|
18
18
|
s.dependency 'GoogleTagManager', '~> 9.1'
|
|
19
19
|
s.swift_version = '5.9'
|
|
20
|
+
# The SDK's categories, as Package.swift's -ObjC; CocoaPods' own default already adds it for most apps.
|
|
21
|
+
s.user_target_xcconfig = { 'OTHER_LDFLAGS' => '$(inherited) -ObjC' }
|
|
20
22
|
end
|
package/Package.swift
CHANGED
|
@@ -18,13 +18,18 @@ let package = Package(
|
|
|
18
18
|
.package(url: "https://github.com/googleanalytics/google-tag-manager-ios-sdk.git", "9.1.0"..<"10.0.0")
|
|
19
19
|
],
|
|
20
20
|
targets: [
|
|
21
|
-
// References the SDK's classes so the linker takes its static archive into the app (see the .m file)
|
|
21
|
+
// References the SDK's classes so the linker takes its static archive into the app (see the .m file), and
|
|
22
|
+
// links with -ObjC so the archive's categories come too. A class reference loads only the object file that
|
|
23
|
+
// defines the class; the SDK adds class methods in categories that live in other object files, and without
|
|
24
|
+
// them the container's first load ends in "+[... runtimeScript]: unrecognized selector" and the app aborts.
|
|
25
|
+
// CocoaPods sets -ObjC for every app, which is why the SDK worked there; SwiftPM does not.
|
|
22
26
|
.target(
|
|
23
27
|
name: "GoogleTagManagerLinkage",
|
|
24
28
|
dependencies: [
|
|
25
29
|
.product(name: "GoogleTagManager", package: "google-tag-manager-ios-sdk")
|
|
26
30
|
],
|
|
27
|
-
path: "ios/Sources/GoogleTagManagerLinkage"
|
|
31
|
+
path: "ios/Sources/GoogleTagManagerLinkage",
|
|
32
|
+
linkerSettings: [.unsafeFlags(["-ObjC"])]),
|
|
28
33
|
.target(
|
|
29
34
|
name: "GoogleTagManagerPlugin",
|
|
30
35
|
dependencies: [
|
package/README.md
CHANGED
|
@@ -75,8 +75,10 @@ Google ships the iOS SDK as a static archive, and an app never calls it: `TAGMan
|
|
|
75
75
|
takes a member of a static archive only when something references a symbol it defines, and Swift Package Manager links
|
|
76
76
|
without `-ObjC`, so an app that merely depends on the package gets the SDK's (empty) framework folder in its bundle and
|
|
77
77
|
none of its code. The plugin's `GoogleTagManagerLinkage` target references every class the SDK exports, which makes the
|
|
78
|
-
linker take them
|
|
79
|
-
|
|
78
|
+
linker take them, and links with `-ObjC`, which takes the SDK's categories as well: they add class methods from object
|
|
79
|
+
files no class reference pulls in, and without them the first container load aborts the app with
|
|
80
|
+
`+[... runtimeScript]: unrecognized selector`. `isAvailable` then looks each class up in the running app. CocoaPods links
|
|
81
|
+
with `-ObjC` for most apps, and the podspec asks for it too.
|
|
80
82
|
|
|
81
83
|
## Use
|
|
82
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-google-tag-manager",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Brings the Google Tag Manager SDK into a Capacitor app on Android and iOS, with its preview activity, so a container shipped with the app is loaded",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|