Skip to content

Commit d5a91ac

Browse files
committed
More of the clean up
1 parent 1daa1b9 commit d5a91ac

5 files changed

Lines changed: 15 additions & 48 deletions

File tree

analytics/src/analytics_ios.mm

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -234,27 +234,6 @@ void LogEvent(const char* name) {
234234
[FIRAnalytics logEventWithName:@(name) parameters:@{}];
235235
}
236236

237-
extern "C" {
238-
void CompleteLogAppleTransaction(const void* context, bool success) {
239-
FIREBASE_ASSERT_RETURN_VOID(context != nullptr);
240-
auto* handle_ptr = static_cast<SafeFutureHandle<void>*>(const_cast<void*>(context));
241-
242-
MutexLock lock(g_mutex);
243-
if (!internal::IsInitialized()) {
244-
delete handle_ptr;
245-
return;
246-
}
247-
248-
auto* api = internal::FutureData::Get()->api();
249-
if (success) {
250-
api->Complete(*handle_ptr, 0, "");
251-
} else {
252-
api->Complete(*handle_ptr, -1, "StoreKit 2 transaction not found.");
253-
}
254-
delete handle_ptr;
255-
}
256-
}
257-
258237
Future<void> LogAppleTransaction(const char* transaction_id) {
259238
MutexLock lock(g_mutex);
260239
FIREBASE_ASSERT_RETURN(Future<void>(), internal::IsInitialized());
@@ -267,14 +246,17 @@ void CompleteLogAppleTransaction(const void* context, bool success) {
267246
return Future<void>(api, future_handle.get());
268247
}
269248

270-
SafeFutureHandle<void>* handle_ptr = new SafeFutureHandle<void>(future_handle);
271-
272-
// 2. Call Swift using a standard Objective-C block.
273-
// We capture the C++ handle_ptr inside the Objective-C block. Swift never sees it.
274249
[AppleTransactionVerifier verifyWithTransactionId:SafeString(transaction_id)
275250
completion:^(BOOL isFound) {
276-
// 3. We are back in C++ land. Call your completion logic directly.
277-
CompleteLogAppleTransaction(handle_ptr, isFound == YES);
251+
MutexLock lock(g_mutex);
252+
if (!internal::IsInitialized()) return;
253+
254+
auto* api = internal::FutureData::Get()->api();
255+
if (isFound) {
256+
api->Complete(future_handle, 0, "");
257+
} else {
258+
api->Complete(future_handle, -1, "StoreKit 2 transaction not found.");
259+
}
278260
}];
279261

280262
return Future<void>(api, future_handle.get());

analytics/src/ios/swift/AppleTransactionVerifier.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ import FirebaseAnalytics
2121
@objc public static func verify(transactionId: String, completion: @escaping @Sendable (Bool) -> Void) {
2222
if #available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *) {
2323
Task {
24+
// Using a manual while loop instead of `for await` avoids a Swift 6 / Xcode 16
25+
// compiler issue. Using `for await` causes the compiler to emit a call to the
26+
// new `next(isolation:)` signature on the generic AsyncIteratorProtocol witness table.
27+
// This symbol does not exist in the iOS 16 `libswift_Concurrency.dylib` runtime,
28+
// which causes an immediate `dyld: Symbol not found` crash upon launch.
2429
var iterator = Transaction.all.makeAsyncIterator()
2530
while let verificationResult = await iterator.next() {
2631
if case .verified(let transaction) = verificationResult {

build_scripts/ios/build.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash -e
22

3-
export LANG=en_US.UTF-8
4-
53
# Copyright 2020 Google LLC
64
#
75
# Script to build iOS XCFrameworks
@@ -125,7 +123,7 @@ if ${generateMakefiles}; then
125123
for arch in ${architectures[@]}; do
126124
sysroot_arg=""
127125
if [[ "${platform}" == "device" && " ${DEVICE_ARCHITECTURES[@]} " =~ " ${arch} " ]]; then
128-
sysroot_arg="-DCMAKE_OSX_SYSROOT=iphoneos"
126+
sysroot_arg="" # Default iphoneos sysroot is correct for iOS devices
129127
elif [[ "${platform}" == "simulator" && " ${SIMULATOR_ARCHITECTURES[@]} " =~ " ${arch} " ]]; then
130128
sysroot_arg="-DCMAKE_OSX_SYSROOT=iphonesimulator" # Must specify sysroot for simulator, especially for x86_64
131129
else

release_build_files/readme.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,6 @@ Note: Parts of the Firebase iOS SDK are written in Swift. If your application
268268
does not use any Swift code, you may need to add an empty .swift file to your
269269
Xcode project to ensure that the Swift runtime is included in your app.
270270

271-
Additionally, to resolve known Xcode 15+ crashes when deploying to iOS 15 or 16,
272-
you must add `-Wl,-weak-lswift_Concurrency` to your `OTHER_LDFLAGS` (Other
273-
Linker Flags). If your application crashes with a 'Symbol not found' error for
274-
`__libcpp_verbose_abort`, you should also add
275-
`-D_LIBCPP_HAS_NO_VERBOSE_ABORT -D_LIBCPP_DISABLE_AVAILABILITY` to your
276-
`OTHER_CPLUSPLUSFLAGS` (Other C++ Flags), or provide a fallback implementation
277-
in your code (e.g., `extern "C" void __libcpp_verbose_abort(const char* f, ...) { abort(); }`).
278-
279271
#### Libraries
280272

281273
If you prefer to link against static libraries instead of xcframeworks (see the
@@ -335,14 +327,6 @@ Note: Parts of the Firebase iOS SDK are written in Swift. If your application
335327
does not use any Swift code, you may need to add an empty .swift file to your
336328
Xcode project to ensure that the Swift runtime is included in your app.
337329

338-
Additionally, to resolve known Xcode 15+ crashes when deploying to iOS 15 or 16,
339-
you must add `-Wl,-weak-lswift_Concurrency` to your `OTHER_LDFLAGS` (Other
340-
Linker Flags). If your application crashes with a 'Symbol not found' error for
341-
`__libcpp_verbose_abort`, you should also add
342-
`-D_LIBCPP_HAS_NO_VERBOSE_ABORT -D_LIBCPP_DISABLE_AVAILABILITY` to your
343-
`OTHER_CPLUSPLUSFLAGS` (Other C++ Flags), or provide a fallback implementation
344-
in your code (e.g., `extern "C" void __libcpp_verbose_abort(const char* f, ...) { abort(); }`).
345-
346330
### Desktop Implementation Dependencies
347331

348332
#### Linux libraries
@@ -634,7 +618,6 @@ code.
634618
- Functions (general): Add in support for Limited Use Tokens.
635619
- Storage: Added `List` API for all platforms, which gets the list of items under a `StorageReference`
636620
- Analytics: Add in `LogAppleTransaction` for logging Storekit 2 transactions on iOS.
637-
- General (iOS): Added `-Wl,-weak-lswift_Concurrency` and `-D_LIBCPP_HAS_NO_VERBOSE_ABORT` flags to resolve Xcode 15+ launch crashes on iOS 15 and 16.
638621

639622
### 13.5.0
640623
- Changes

scripts/gha/integration_testing/xcode_tool.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def main
8989

9090
framework_dir = "#@xcode_project_dir/Frameworks"
9191
set_build_setting('FRAMEWORK_SEARCH_PATHS', ['${inherited}', framework_dir])
92-
9392
if !@include_path.nil?
9493
append_to_build_setting('HEADER_SEARCH_PATHS', @include_path)
9594
end

0 commit comments

Comments
 (0)