Skip to content

Commit 3b8e555

Browse files
authored
[Firestore] Programmatically link un-linked symbols (#10896)
* [Firestore] Force link un-linked symbols * Style
1 parent 5c5596d commit 3b8e555

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Firestore/Source/API/FIRFirestore.mm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,17 @@ - (void)terminateInternalWithCompletion:(nullable void (^)(NSError *_Nullable er
545545
_firestore->Terminate(MakeCallback(completion));
546546
}
547547

548+
#pragma mark - Force Link Unreferenced Symbols
549+
550+
extern void FSTIncludeFSTFirestoreComponent(void);
551+
552+
/// This method forces the linker to include all the Analytics categories without requiring app
553+
/// developers to include the '-ObjC' linker flag in their projects. DO NOT CALL THIS METHOD.
554+
+ (void)notCalled {
555+
NSAssert(NO, @"+notCalled should never be called");
556+
FSTIncludeFSTFirestoreComponent();
557+
}
558+
548559
@end
549560

550561
NS_ASSUME_NONNULL_END

Firestore/Source/API/FSTFirestoreComponent.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,9 @@ + (void)load {
176176

177177
@end
178178

179+
/// This function forces the linker to include `FSTFirestoreComponent`. See `+[FIRFirestore
180+
/// notCalled]`.
181+
void FSTIncludeFSTFirestoreComponent(void) {
182+
}
183+
179184
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)