@layers/react-native 3.1.2 → 3.1.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"att-BDPyE-Gs.d.mts","names":[],"sources":["../src/att.ts"],"sourcesContent":[],"mappings":";KAGY,SAAA;AAAA,iBAsBU,YAAA,CAAA,CAtBD,EAsBiB,OAtBjB,CAsByB,SAtBzB,CAAA;AAsBC,iBAMA,4BAAA,CAAA,CANuB,EAMS,OANT,CAMiB,SANjB,CAAA;AAMvB,iBAUA,cAAA,CAAA,CAV4B,EAUV,OAVsB,CAAA,OAAR,CAAA;AAUhC,iBAMA,gBAAA,CAAA,CANyB,EAML,OANK,CAAA,MAAA,GAAA,IAAA,CAAA;AAMzB,iBAQA,WAAA,CAAA,CARoB,EAQL,OARY,CAAA,MAAA,GAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"att-BDPyE-Gs.d.mts","names":[],"sources":["../src/att.ts"],"sourcesContent":[],"mappings":";KAGY,SAAA;AAAA,iBAsBU,YAAA,CAAA,CAtBD,EAsBiB,OAtBjB,CAsByB,SAtBzB,CAAA;AAsBC,iBAMA,4BAAA,CAAA,CANuB,EAMS,OANT,CAMiB,SANjB,CAAA;AAMvB,iBAUA,cAAA,CAAA,CAV4B,EAUV,OAVsB,CAAA,OAAA,CAAR;AAUhC,iBAMA,gBAAA,CAAA,CANyB,EAML,OANK,CAAA,MAAA,GAAA,IAAA,CAAA;AAMzB,iBAQA,WAAA,CAAA,CARoB,EAQL,OARY,CAAA,MAAA,GAAA,IAAA,CAAA"}
@@ -20,10 +20,23 @@ class LayersAdServices: NSObject {
20
20
  }
21
21
  // Use method(for:) + unsafeBitCast to invoke the throwing ObjC method
22
22
  // that takes an NSError** parameter. perform(_:) cannot handle this.
23
- var error: NSError?
23
+ //
24
+ // The out-parameter MUST be typed `Unmanaged<NSError>?`, not `NSError?`.
25
+ // Per Cocoa's NSError** convention the callee writes the error
26
+ // autoreleased (+0). Storing that through a raw pointer into an
27
+ // ARC-managed `NSError?` bypasses ARC's retain-on-write while ARC still
28
+ // emits a balancing `release` at scope exit, so the autoreleased error is
29
+ // released twice — a crash when the autorelease pool drains (EXC_BAD_ACCESS
30
+ // in objc_autoreleasePoolPop). On the Simulator the AAAttribution class is
31
+ // present (so the guards above pass) but the attribution call itself fails —
32
+ // there is no attribution environment — and writes a non-nil error on every
33
+ // launch, firing the over-release every time. `Unmanaged` opts out of ARC
34
+ // management, leaving the pool as the sole owner. The error is never read,
35
+ // so nothing needs balancing here.
36
+ var error: Unmanaged<NSError>?
24
37
  let token = withUnsafeMutablePointer(to: &error) { errorPtr -> String? in
25
38
  let imp = cls.method(for: sel)
26
- typealias MethodType = @convention(c) (AnyClass, Selector, UnsafeMutablePointer<NSError?>) -> NSString?
39
+ typealias MethodType = @convention(c) (AnyClass, Selector, UnsafeMutablePointer<Unmanaged<NSError>?>) -> NSString?
27
40
  let method = unsafeBitCast(imp, to: MethodType.self)
28
41
  let result = method(cls, sel, errorPtr)
29
42
  return result as String?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layers/react-native",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -66,7 +66,7 @@
66
66
  "mobile"
67
67
  ],
68
68
  "dependencies": {
69
- "@layers/core-wasm": "3.1.2"
69
+ "@layers/core-wasm": "3.1.3"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@react-native-async-storage/async-storage": ">=1.21.0",