Skip to content

Commit 284a986

Browse files
authored
[AppCheck] Force link categories (#13435)
1 parent 83d40eb commit 284a986

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

FirebaseAppCheck/Sources/Core/FIRApp+AppCheck.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ - (NSString *)resourceName {
2424
}
2525

2626
@end
27+
28+
/// Stub used to force the linker to include the categories in this file.
29+
void FIRInclude_FIRApp_AppCheck_Category(void) {
30+
}

FirebaseAppCheck/Sources/Core/FIRAppCheck.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,20 @@ - (NSString *)resourceNameForApp:(FIRApp *)app {
267267
stringWithFormat:@"projects/%@/apps/%@", app.options.projectID, app.options.googleAppID];
268268
}
269269

270+
#pragma mark - Force Category Linking
271+
272+
extern void FIRInclude_FIRApp_AppCheck_Category(void);
273+
extern void FIRInclude_FIRHeartbeatLogger_AppCheck_Category(void);
274+
275+
/// Does nothing when called, and not meant to be called.
276+
///
277+
/// This method forces the linker to include categories even if
278+
/// users do not include the '-ObjC' linker flag in their project.
279+
+ (void)noop {
280+
FIRInclude_FIRApp_AppCheck_Category();
281+
FIRInclude_FIRHeartbeatLogger_AppCheck_Category();
282+
}
283+
270284
@end
271285

272286
NS_ASSUME_NONNULL_END

FirebaseAppCheck/Sources/Core/FIRHeartbeatLogger+AppCheck.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ - (GACAppCheckAPIRequestHook)requestHook {
3131
}
3232

3333
@end
34+
35+
/// Stub used to force the linker to include the categories in this file.
36+
void FIRInclude_FIRHeartbeatLogger_AppCheck_Category(void) {
37+
}

0 commit comments

Comments
 (0)