Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app-check, ios): remove import loop to fix protocol def warning #8133

Merged

Conversation

mikehardy
Copy link
Collaborator

@mikehardy mikehardy commented Nov 14, 2024

Description

Import loops can apparently be the root cause of protocol definition issues, and if you ensure imports only happen once by chaining correctly then protocol definitions are found correctly and the warning goes away

This warning:

tests/ios/build/Build/Products/Debug-iphonesimulator/RNFBAppCheck/RNFBAppCheck.framework/Headers/RNFBAppCheckProviderFactory.h#L20
cannot find protocol definition for 'FIRAppCheckProviderFactory'

Has been present since I originally implemented this feature to glue together the native SDK app check init process into something that looked like the firebase-js-sdk style, and I couldn't figure it out at the time

While reviewing another PR I saw this again though and it bothered me so I took another look at it. Stackoverflow provided the guidance that import loops can cause this unhelpful error and sure enough cleaning up the imports so they are singular in all cases appears to have fixed it

Related issues

Release Summary

conventional commit so merge+rebase will work

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

If app check still builds+works in CI at all this works, because this object is used in testing and it will work completely or break completely with this change


Think react-native-firebase is great? Please consider supporting the project with any of the below:

Copy link

vercel bot commented Nov 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 14, 2024 2:03pm

import loops can apparently be the root cause of protocol definition issues,
and if you ensure imports only happen once by chaining correctly then protocol
definitions are found correctly and the warning goes away
@mikehardy mikehardy force-pushed the @mikehardy/fix-appcheckproviderfactory-protocol-def-warning branch from 5a81ae4 to e07cd2c Compare November 14, 2024 13:58
@mikehardy
Copy link
Collaborator Author

Yes! Finally nailed this compile warning - it's the last one that was left in the react-native-firebase apple native code after previous fixes

https://github.com/invertase/react-native-firebase/actions/runs/11838691057/job/32988438998?pr=8133#step:19:4239

@@ -16,10 +16,7 @@
*/

#import "RNFBAppCheckProviderFactory.h"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one imports RNFBAppCheckProvider.h, which imports the others, including them again below caused the loop which caused the warning

@@ -15,7 +15,7 @@
*
*/

#import <FirebaseAppCheck/FIRAppCheck.h>
#import "RNFBAppCheckProvider.h"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including FIRAppCheck here also contributed to the loop, so instead chain to the "parent" header file, and it includes all the others but this way they are included once-and-only-once

@@ -16,13 +16,13 @@
*/

#import <Firebase/Firebase.h>
#import <FirebaseAppCheck/FIRAppCheck.h>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was just a style change from "" style imports to <>

@mikehardy mikehardy merged commit 789d41b into main Nov 14, 2024
19 checks passed
@mikehardy mikehardy deleted the @mikehardy/fix-appcheckproviderfactory-protocol-def-warning branch November 14, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants